• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Jackson validation for "\;" in a json request

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am using jackson object mapper to validate and unmarshall the json request , currently facing below issue with special characters "\;";

Input request has this element : "lastName": "GADD2\;:”’,.?/ AAC??¼ÆÐæ"

com.fasterxml.jackson.databind.JsonMappingException: Unrecognized character escape ';' (code 59)

when i applied below configuration , it doesn't produce "\" in output.

mapper.configure(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER, true);

Any help regarding this will be much appreciated since it is a blocker for me.

Regards,
Vijay
 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not a valid JSON string. This railroad diagram shows what is valid:

As you can see, there is no ";" after "\". If your JSON strings should contain backslashes (or newlines or tabs or ...), they should be escaped using prefix backslashes by whichever component is producing the JSON:
 
vdammala vkumar
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excellent Karthik , thanks for your effort...I will take care of it.
 
vdammala vkumar
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Karthik , Adding one more "\" to it resolved the problem

Actual : GADD2\;:”’,.?/ AAC??¼ÆÐæ

Fix : GADD2\\;:”’,.?/ AAC??¼ÆÐæ
 
All of the following truths are shameless lies. But what about this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic