Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello y'all,
I've got a regular .csv file, with around 30 regular columns. However, a couple of columns are JSON text.
I would like to parse the JSON text and get some extra columns from it.
I've tried to use a tExtractJSONFields, but there are two flaws:
- the component seems to be expecting a full JSON input, not a JSON column among regular string-type columns
- I hardly know anything about Json paths and Json queries
The JSON column is called 'jugement', one of the JSON property I need from it is called 'complementJugement', so I've used '$.jugement' as the Jsonpath query and 'complementJugement' as the Json query mapped to a new schema column. I got this error message:
Expected to find an object with property ['jugement'] in path $ but found 'java.lang.Integer'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.
Can anyone help me with this issue?
Thanks in advance
Hi @Antoun,
Thank you for reaching out to Qlik community.
The error happens because Talend’s tExtractJSONFields expects the column itself to contain valid JSON text. If the JSON path is written incorrectly, Talend cannot read it and shows the error.
If you use the wrong JSONPath (like $.jugement.complementJugement), Talend cannot parse it and throws this error.
To Fix the above issue please try the following
1. Point the component to the jugement column.
2. Use the path $.complementJugement to get that property.
3. Make sure the column really contains valid JSON text.
If the error persists, check Talend’s bundled JSON‑Smart library version. Some older builds had parsing bugs and upgrading to the latest patch resolves this issue.
You can enable “Ignore errors” in tExtractJSONFields to skip rows with invalid JSON instead of failing the job.
Hello Antoun,
you can input a schema of multiple columns into a tExtractJsonFields. You select one of those columns for the component to do the Json parsing, so in your case the 'Json Field' property would be 'jugement' (the the name of the Json column). The Jsonpath Query is just "$". The 'mapping' of the schema columns has your other csv file columns with an empty Json query, and the new columns you want to extract from your Json input string have the Json attribute name as the Json query, so for example the (new output) column 'compJugement' has the Json query "complementJugement".
A tExtractJsonFields component can only process one column for Json parsing, so will have to use multiple components to process multiple Json string columns.
Best regards,
Thomas