Skip to main content
Added Exception
Source Link
AKA
  • 111
  • 4

The following is my JSON file:

{
    "data" : [
               {
                 "nameString" : "My name is \"Ansar\"",
                 "id" : 1234
               } 
    ]
}

When I try to parse this JSON file using JsonUtility, it is throwing an exception because of the " character. If I remove the character from the string, it works smoothly.

Exception:

ArgumentException: JSON parse error: Missing a comma or '}' after an object member.
UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) (at /Users/builduser/buildslave/unity/build/Modules/JSONSerialize/Public/JsonUtility.bindings.cs:50)

Why this is happening? Is this a JsonUtility bug? Anyways to fix this?

The following is my JSON file:

{
    "data" : [
               {
                 "nameString" : "My name is \"Ansar\"",
                 "id" : 1234
               } 
    ]
}

When I try to parse this JSON file using JsonUtility, it is throwing an exception because of the " character. If I remove the character from the string, it works smoothly.

Why this is happening? Is this a JsonUtility bug? Anyways to fix this?

The following is my JSON file:

{
    "data" : [
               {
                 "nameString" : "My name is \"Ansar\"",
                 "id" : 1234
               } 
    ]
}

When I try to parse this JSON file using JsonUtility, it is throwing an exception because of the " character. If I remove the character from the string, it works smoothly.

Exception:

ArgumentException: JSON parse error: Missing a comma or '}' after an object member.
UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) (at /Users/builduser/buildslave/unity/build/Modules/JSONSerialize/Public/JsonUtility.bindings.cs:50)

Why this is happening? Is this a JsonUtility bug? Anyways to fix this?

Source Link
AKA
  • 111
  • 4

JsonUtility is throwing exception when there is \" in the string

The following is my JSON file:

{
    "data" : [
               {
                 "nameString" : "My name is \"Ansar\"",
                 "id" : 1234
               } 
    ]
}

When I try to parse this JSON file using JsonUtility, it is throwing an exception because of the " character. If I remove the character from the string, it works smoothly.

Why this is happening? Is this a JsonUtility bug? Anyways to fix this?