• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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??¼ÆÐæ
 
He baked a muffin that stole my car! And this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic