Avatar

Community Advisor

Hi Jon,

I want to assign below values from received JSON to variables:

            "address":{

              "houseNumber":"20",

              "street":"Massima d"Agnolia",

              "zip":"10000",

              "city":"" }

var house_number: 20    - this is fine

var street:  Massima d    - this is wrong becasue " was not escaped, "Agnolia" is missing

var zip:                            -  this will be undefined, can't find this value becase next one is "Agnolia" instead of "zip"

I need a way to properly escape JSON from JavaScript in order to continue processing data.

From this JSON example value "Massima d"Agnolia"  needs to be converted to:  "Massima d\"Agnolia"

Thanks,

Milan