"String to JSON" error

Hi …

I keep getting this error:

“ERROR String to JSON 5:15 Execute failed: Unexpected character (‘,’ (code 44)): was expecting a colon to separate field name and value at [Source: (StringReader); line: 1, column: 134] in row: Row18”

When I try to parse this string (which is row 18 in the table):

{“timestamp” : “1685082350225”, “data” : {“entityType”:“IndividualEntity”,“serviceName”:“client”,“entity”:{“types”:[“LIAISON”,“OWNER”],“identificationType”:{“createdAt”:1673872677526,“code”:“SAID”,“name”:“South African ID”,“description”:“South African ID number.”,“id”:2,“lastModified”:1673872677526},“idNumber":“2305301234567”,“title”:“Miss”,“emailAddress”:"myname@gmail.com”,“nationality”:{“createdAt”:1673872674138,“code”:“ZA”,“name”:“South Africa”,“description”:null,“id”:260,“lastModified”:1673872674138},“streetAddress”:{“country”:{“createdAt”:1673872674138,“code”:“ZA”,“name”:“South Africa”,“description”:null,“id”:260,“lastModified”:1673872674138},“province”:{“createdAt”:1675167586260,“name”:“Gauteng”,“id”:4,“lastModified”:1675167586260},“city”:{“createdAt”:1685082349294,“name”:“midrand”,“id”:14,“lastModified”:1685082349294},“postalCode”:“1809”,“coordinates”:null,“client”:{“website”:null,“tradingHistory”:null,“dateJoined”:1685082347788,“language”:“eng”,“type”:“DIRECT”,“classification”:{“createdAt”:1673872322021,“code”:“SoleProp”,“name”:“Sole Proprietor”,“description”:“This is a business owned by one person. It is not registered with CIPC.”,“id”:1,“lastModified”:1673872322021},“fica":null,“dateCancelled”:null,“createdAt”:1685082348207,“emailAddress”:"myname@gmail.com”,“kyc”:null,“registrationNumber”:null,“tradingAs”:“Myname Botique”,“name”:“Myname Botique”,“contactNumber”:“+27121234567”,“id”:125,“lastModified”:1685082348207,“riskAssessment”:null,“vatNumber”:null,“status”:{“createdAt”:1673872321617,“code”:“Active”,“name”:“Active”,“description”:“Client is active.”,“id”:1,“lastModified”:1673872321617}},“id”:301,“type”:“STREET”,“line2”:“the new estate, glen austin”,“line1”:“508 someorother street”},“surname”:“Mylastname”,“contactNumber”:“+27121234567”,“name”:“Mynamee”,“refugeeAsylumSeeker”:false,“client”:{“website”:null,“tradingHistory”:null,“dateJoined”:1685082347788,“language”:“eng”,“type”:“DIRECT”,“classification”:{“createdAt”:1673872322021,“code”:“SoleProp”,“name”:“Sole Proprietor”,“description”:“This is a business owned by one person. It is not registered with CIPC.”,“id”:1,“lastModified”:1673872322021},“fica":null,“dateCancelled”:null,“createdAt”:1685082348207,“emailAddress”:"myname@gmail.com”,“kyc”:null,“registrationNumber”:null,“tradingAs”:“Myname Botique”,“name”:“Myname Botique”,“contactNumber”:“+27121234567”,“id”:125,“lastModified”:1685082348207,“riskAssessment”:null,“vatNumber”:null,“status”:{“createdAt”:1673872321617,“code”:“Active”,“name”:“Active”,“description”:“Client is active.”,“id”:1,“lastModified”:1673872321617}},“id”:103},“updateType”:“SAVE”}}

I tested the string in JSONLint and it seems to be valid JSON. Can anyone perhaps identify what might be causing the error or suggest a fix?

Thanks

tC/.

Are these really “normal quotes”? would check for that
br

1 Like

Hi @TigerCole ,

Can you isolate the specific row again, as I suspect this isn’t the one actually having the problem. I pasted your json into an editor, (and fixed the double-quotes that had been “corrupted” by the forum ) and was able to perform a StringToJSON on the final result with no problems.

I suggest you put a row filter in your code just before the StringToJSON and isolate one or maybe two rows either side of Row18 until you have only a single row and it is causing the error. If in doubt, upload additional “rows”.

When posting a new sample of JSON, can you save it in a .json file and then upload that so we can be sure that the forum doesn’t modify it.

[edit: @Daniel_Weikert has posted while I’ve been writing, and raises a good point. I’ve assumed that the forum upload has altered the double-quotes, but maybe it hasn’t and this is actually your problem!

[edit2: Actually that raises a different error, if I use the “smart quotes” and actually you said it works in json lint so I’m going back to assuming the smart quotes is a forum-upload-artifact ]

Hi @takbb and @Daniel_Weikert ,

My apologies for doing things the hard way and not providing the row as *.json file.

ProblemRow.json (2.5 KB)

Still getting the error…

tC/.

Hi @TigerCole , are you sure it is that row?

When I run that through String to JSON it works fine. (see attached)

String to JSON.knwf (7.8 KB)
Keep in mind that “Row18” is likely to be the rowid and so this will be the 19th row (it will start with Row0).

Incidentally I can emulate the error you are seeing by manually replacing a : with a ,
e.g.
If I duplicate your data and replace the : after “data” with a comma:

Further experimentation… if I change the : after “timestamp” instead, the error message changes to:

So, I would think you are looking for a “,” in your data, which should be a “:” at the row with RowId “Row18” (probably row 19), at approximately 134 characters in (not quite sure how its counting works. It isn’t exact, and likely to be somewhere a bit before the 134th character)

String to JSON - with manual edit to cause error.knwf (10.4 KB)

If you can’t positively identify the failing row, try turning off the “Fail on Error” on the String to JSON

image

and then see which row is “missing”

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.