Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

extract json data from a rest url

I am trying to get a json result from rest URL. Then extract the data items and process them into another format.
The following image is what I did. The json result is like this. What I want is the data from "data", like "id", "Replenishment Status" , "Supplier Name(id)"... But I always got the error "Error on line 1 of document  : Attribute name "Status" associated with an element type "Replenishment" must be followed by the ' = ' character. Nested exception: Attribute name "Status" associated with an element type "Replenishment" must be followed by the ' = ' character.
disconnected"
I guess this is caused by there is a space in between "Replenishment Status" .
I saw there was a ticket has the same issue this one:  https://jira.talendforge.org/browse/TDI-31974
I am using TOS 6.1, also I tried the latest version 6.2.1. They all have the same problem.
When I remove tExtractJsonField component, the result printed out correctly.
May I know if there is a solution for this? If I cannot use tExtractJsonField,  is there any other way I can map those json data into other format?
Thanks!

{
  "structure":
    },
    {
      "name": "ShipTo Address Line 3",
      "type": "dropDown",
      "required": false,
      "unique": false,
      "canRead": false,
      "canUpdate": true,
      "canCreate": true,
      "choices":
    },
    {
      "name": "Note",
      "type": "paragraph",
      "required": false,
      "unique": false,
      "canRead": true,
      "canUpdate": true,
      "canCreate": true
    },
    {
      "name": "Received Quantity",
      "type": "number",
      "required": false,
      "unique": false,
      "canRead": false,
      "canUpdate": true,
      "canCreate": true
    }
  ],
  "data": ,
  "totalCount": 3
}
0683p000009MBe4.png 0683p000009MBe9.png
Labels (4)
2 Replies
Anonymous
Not applicable
Author

Hi 
I tested and got the same result.Try to replace all " Replenishment Status" with " Replenishment_Status" on a tJavaRow before tExtractJsonFields,  , for example:
...tJavaRow--main--tExtractJsonFields...
on tJavaRow:
output_row.result=input_row.result.replaceAll(" Replenishment Status "," Replenishment_Status ")

Regards
Shong
bhagyarekha
Creator II
Creator II

Hi Shong,
i have tried 
trest--->(main) textractjsonfields----->tmap---->tmysqloutput
here am unable to complie the job.am getting error notification as
 ERROR_CODE cannot be resolved or it is not field
Body cannot be resolved or it is not field
what settings i need to use in tRest.am passing an url.no ned to pass any headers.
here i have tried tfilejsoninput with url,
but i got
java.io.IOException: Illegal character: <>
this exception.
am using encode as UTF-8
Appreciate for quick response
Regards,
Rekha