• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Jackson validation for "\;" in a json request  RSS feed

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • 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 C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
Karthik , Adding one more "\" to it resolved the problem

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

Fix : GADD2\\;:”’,.?/ AAC??¼ÆÐæ
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!