Greg Greg - 5 months ago 19
Java Question

Getting a JSONException because of a colon

I'm getting my JSON values from a linkedHashMap

LinkedHashMap<String,Object> lst = JsonPath.parse(json).read("$.projects[0].issuetypes[0].fields");

This is the JSON I'm trying to parse :

"required": false,
"schema": {
"type": "string",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:textfield",
"customId": 10161
"name": "Error Code",
"operations": [

Then I was thinking that this would do the job

JSONObject jsonObject = new JSONObject(lst.get(key).toString());

But then I got this exception:

Exception in thread "main" org.codehaus.jettison.json.JSONException: Expected a ',' or '}' at character 95 of {required=false, schema={type=string, custom=com.atlassian.jira.plugin.system.customfieldtypes:textfield, customId=10161}, name=Error Code, operations=["set"]}

Character 95 is the colon between customfieldtypes and textfield

What could be wrong with this ?


You are trying to parse a serialized object, which is not valid JSON.


does not produce JSON.