Question

My JSON return string has something like below

 ** \u00AE in between some string **

I have parsed using jackson parser something like

returnedPOJO = objectmapper.readvalues(jsonstring,userdefinedclass);

Now the returnedPOJO has values but the problem is \u00AE has been changed to some character like y with some 2 dots top.

so how to parse json to POJO without any modification of \u00AE.

Please help.

see my json below and find the card-name wit utf-8

{
    "partner-code":"DINERS",
    "partner":"Diners Club",
    "issuer":"Diners Club",
    "url":"http://dinersclub.com.au/travel_card.htm",
    "mediafile":[

    ],
    "general-terms-and-conditions":"<p style=\"line-height:15.6pt\"><span style=\"font-size: 10pt; font-family: Arial, sans-serif;\">Card products referred to are not Qantas products and not offered or issued by Qantas but by the relevant Card partners. The applicable Card Partner is the credit provider and credit licensee under the National Consumer Credit laws. Points are offered by the relevant Card partner and partner reward program and can only be earned on eligible purchases. Contact the relevant Card Partner for terms and conditions or enquiries.<p></p></span></p>\n\n<p style=\"line-height:15.6pt\"><span style=\"font-size: 10pt; font-family: Arial, sans-serif;\">If you are interested in a Card, make sure you check out all its features on the applicable Card Partner's website as Card features are only summarised here. Card features information is based solely on information supplied by the Card Partner. The information is current as at 13 February 2014 and is subject to change. Qantas has made reasonable efforts to confirm with the applicable Card Partner as to the accuracy of information provided on this site but is not responsible for errors or omissions.<p></p></span></p>\n",
    "card-offerings":[
      {
        "sequence-no":"6",
        **"card-name":"Frequent Flyer Diners Club Card with World MasterCard Card\u00ae",**
        "earning-points":"This charge card lets you earn Qantas Points which are directly credited to your account.",
        "website":"http://dinersclub.com.au/travel_card.htm",
        "contact-phone-number":"1300 360 060",
        "usage-type":"Personal",
        "card-level":"World",
        "card-type-01":"Diners Club",
        "per-dollar-card-type-01":"1.5",
        "earned-area-card-type-01":"1.5 Qantas Points per $1 spend on eligible purchases^ up to $60,000 per annum<br />\r\n<br />\r\n1.25 points per $1 spend on eligible purchases^ over $60,000 per annum",
        "mediafile-card-type-01":{
          "fid":"129266",
          "alt":"",
          "title":"",
          "width":"280",
          "height":"176",
          "uid":"128",
          "filename":"AmexDisco.jpg",
          "uri":"http://qf-partners-media.s3.amazonaws.com/card-banking-partners/AmexDisco_3.jpg",
          "filemime":"image/jpeg",
          "filesize":"28573",
          "status":"1",
          "timestamp":"1392891657",
          "rdf_mapping":[

          ]
        }]}

Have used the following code to read the value and converting into POJO after conversion card-name value in POJO is converted into some ?

JsonFactory jfactory = new JsonFactory();           
JsonParser jParser = jfactory.createJsonParser(jsonStringToconvertAsObjects);


        // advance stream to START_ARRAY first:
        jParser.nextToken();


           while (jParser.nextToken() != JsonToken.END_ARRAY) {

     CardPartner cardPartner = mapper.readValue(jParser, CardPartner.class);

    cardPartnerList.add(cardPartner);
    if(cardPartner!=null)
    {
    for(CardOffer card :cardPartner.getCardOfferings())
    {
                            System.out.println("cardname:"+card.getCardName());
    }
     }
      }

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top