• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

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??¼ÆÐæ
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic