0

I have an application that Written with phonegap. I'm trying to pass "json"(string) from objective c code to javascript code. the json contains Hebrew letters,the json looks like this:

{
    "cell":[
    {
      "CellType":"HomePageData",
      "HBImage":"https://www.wwe.co.il/he-il/we/we/we/2013/04April/TFS/TFS_Big.jpg",
      "TitleA":"Twentyfourseven ",
      "SubTitle":"50 ש\"ח הנחה בקנייה ב- 250 ש\"ח ",
      "PurchaseType":"0",
      "BenefitId":"101616",
      "BenefitBalance":"",
      "CustomerFirstName":"",
      "CurrentBenefitNum":""
    }]
 }

After the json comes to javascript I do Presser wite jQuery.parseJSON.

Although the json is legal I get the error Syntax Error or Unexpected token

When deserve json which does not contain Hebrew letters it's ok.

thanks.

1 Answer 1

1

Actually you dont need to parse this json

you can access it directly with:

var a= {
            "cell":[
                {
                    "CellType":"HomePageData",
                    "HBImage":"https://www.wwe.co.il/he-il/we/we/we/2013/04April/TFS/TFS_Big.jpg",
                    "TitleA":"Twentyfourseven ",
                    "SubTitle":"50 ש\"ח הנחה בקנייה ב- 250 ש\"ח ",
                    "PurchaseType":"0",
                    "BenefitId":"101616",
                    "BenefitBalance":"",
                    "CustomerFirstName":"",
                    "CurrentBenefitNum":""
                }]
        }


    alert(a.cell[0].CellType)
    alert(a.cell[0].CellType)
    alert(a.cell[0].HBImage)
    alert(a.cell[0].TitleA)
    alert(a.cell[0].SubTitle)

and so on..

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.