Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am trying to use a local JSON file as the body in a request using the tREST component. I also tried the tRESTClient component.
What is the simplest way to take a file and use it in the body of the HTTP request? I want to use the raw input from the file because when I use tMap it keeps escaping the special characters in the JSON.
INPUT:
{
"name":"Test",
"fruits":[
"Apples",
"Bananas"
]
}
OUTPUT:
{
"fileInfos": [
{
"name": "Test",
"fruits___": "[\"Apples\",\"Bananas\"]"
}
]
}
Thanks,
Ray
Hi
Have a try to read the file as a string using tFileInputRaw, pass the string to tRest as Http body (with post method).
Regards
Shong
Hi Shong,
Thanks for your reply!
I was just finishing up some work with the Raw File components. Seems the key is to use global variables. I have a deadline to meet with this but will post a video or something later about how I am handling complex JSON structures. As it seems nested arrays create some pretty difficult to deal with special characters in the JAVA.
Talk soon,
Ray
Hi All,
I was able to do this more simply using Talend and some python locally. You can:
Thanks,
Ray