From this example, the content that need to be update are the fields "numberOfLike", and also the array relatedPage (I want to replace the full array with an other one). I try (without no idea how to do better) to reconstruct my object : tExtractJSONField_1 -- tWriteJSONField -- tExtractJSONField_2 In tExtractJSONField_1, I get the content of my json object that need to be reused ("user","code","name"), and pass my new field ("numberOfLike", "RelatedPages", and also my other field for further purpose) In tWriteJSONField, I construct a new object :
In my last tExtractJSONField_2, I separate my field to get my new "jsonObject" with the new info, and the "object1". When I put the jsonObject in my Collection, the field are not in the same order. Is there an explanation ? Or did I miss something ? (It's just for clarity, the data are still usable). Also, is there a better way to update the content of a json object directly in talend ? In my real case test, I have ~40 fields, and if I add some more, I'll need to modify this job just to add the content ( ). Sincerely, Morgan
Hi, nevermind, i found my problem. Using tJSONExtract with the JSONPath setting doesn't guarantee the order, contrary to the XPATH setting. It's just annoying to use XPATH since it's not seems to be the best one for nested array in json ! Thanks !