Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to use the tfileoutputjson component but it is inserting new line characters in the file which means I can't use a json path query to extract the fields I need.
My flow is trestclient ---- tfileoutputjson. The json is formatted as expected when I use tlogrow. Any ideas how I prevent the "\n" being inserted in the output file?
Hello,
Could you please elaborate your case with an example with input and expected output values?
Best regards
Sabrina
Yes, sure. I am using the Google Places api and am expecting to receive a response in the following format:
{ "html_attributions": [], "results": [ { "formatted_address": "London, United Kingdom", "geometry": { "location": { "lat": 0.5153788, "lng": -0.1392263 }, "viewport": { "northeast": { "lat": 0.52708884999999, "lng": -0.13778035 }, "southwest": { "lat": 0.51147545000001, "lng": -0.14356415 } } }, "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png", "id": "c1942d9a94bad7dd667149b40786f0a0f6bd6769", "name": "Company Name", "place_id": "Place_id", "rating": 5, "reference": "example", "types": [ "point_of_interest", "establishment" ] } ], "status": "OK" }
But what I actually get back is in this format
{"data":[{"string":"{\n \"html_attributions\" : [],\n \"results\" : [\n {\n \"formatted_address\" : \"London, United Kingdom\",\n \"geometry\" : {\n \"location\" : {\n \"lat\" : 0.5153788,\n \"lng\" : -0.1392263\n },\n \"viewport\" : {\n \"northeast\" : {\n \"lat\" : 0.52708884999999,\n \"lng\" : -0.13778035\n },\n \"southwest\" : {\n \"lat\" : 0.51147545000001,\n \"lng\" : -0.14356415\n }\n }\n },\n \"icon\" : \"https:\/\/maps.gstatic.com\/mapfiles\/place_api\/icons\/generic_business-71.png\",\n \"id\" : \"c1942d9a94bad7dd667149b40786f0a0f6bd6769\",\n \"name\" : \"DataXu\",\n \"place_id\" : \"place_id",\n \"rating\" : 5,\n \"reference\" : \"CmRRAAAADMfvTkEkMvnLOOa-WXca3olzFgUz9d17pkzsD4bfxkU_-c9lE63nWsGj8YZJLH7p6BMRWyOmKhYWX35pioAN1Q-doaO-caPt-KuVI_wEhtOiSmXACU6ry_WwqCu1X8DVEhDkPbQfutBaWY7K0FHFwajUGhT6wziXwKWKZqGgOZ0D3dJL95bk6g\",\n \"types\" : [ \"point_of_interest\", \"establishment\" ]\n }\n ],\n \"status\" : \"OK\"\n}\n","body":null,"statusCode":200}]}
This is my flow.
In tFileInputJSON I am trying to retrieve the place_id from the json file using the jsonpath query displayed, but because of the file format it is not working.
Thanks
Any advice on this one?
I have the same problem!
It's like the component tries to stringify every fields and every value.
Anyone can help us?
I think your webservice is returning wrong data, as talend json outpout properly works , even it's not indented.
Any answer on this? I have the same issue and it's not the web service as it looks fine in the tLogRow directly before the tFileOutputJSON