Highlighted
One Star

Get JSON data from REST web service but cannot parse??

Hello!
Am in a terribly sticky situation. What I have is the following setup:
tRESTClient --> tExtractJSONFields --> tLogRow
Now, if I skip the tExtractJSON fields and put the REST GET results right to the tLogRow, the body Document object data shows up... as a XML file! (This is if I wrap JSON response; if I don't, it shows up as a JSON file.) However, attempting to parse the data into the appropriate fields, the best that I have gotten is a bunch of rows with blank fields, which is not what the web service returns.
Here are my settings. I have tried a number of different permutations and these are frankly the best I ever get:
tRESTClient

HTTP Method: GET
Type: JSON
Convert Response to DOM Document: True
Wrap JSON Response: True
Schema:

statusCode (Integer)
body (Document)
string (String 4048)

tExtractJSONFields

Read By: Xpath
Champ JSON: body
XPath Query Loop: "/root/products"
Mapping:

id : "/id"
code : "/code"
provider : "/provider"
type : "/type"
label : "/label"
currency : "/currency"

And here is my data:
Document object string (if I don't convert to DOM):

{"products": }
(Please note there are no breaks or spaces between items in the actual object; I have included them here for your eyes.)
Document object body (if I convert to DOM):
<?xml version="1.0" encoding="UTF-8"?>
<root>
    <products>
        <id>11111</id>
        <code>AAA</code>
        <provider>BBB</provider>
        <type>CCC</type>
        <label>DDD</label>
        <currency>EEE</currency>
    </products>
    <products>
        <id>22222</id>
        <code>FFF</code>
        <provider>GGG</provider>
        <type>HHH</type>
        <label>III</label>
        <currency>JJJ</currency>
    </products>
</root>
(Please note there are no breaks or spaces between items in the actual object; I have included them here for your eyes.)
tLogRow output with settings above:
id code provider type label currency
|||||
|||||
Any ideas?? I'm going crazy!
Many thanks and have a nice weekend anyhow!
Cheers,
Nico
1 REPLY
One Star

Re: Get JSON data from REST web service but cannot parse??

I would make sure that the tLogRow has the proper schema mapping.  In theory, the tlogRow should the raw string of whatever is inside the trestclient column ... 
are you just trying to read the fields?  it seems you are able to read the JSON object contents.