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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Parikhharshal
Creator III
Creator III

Shows null values for tExtractJasonFields

Hi there

 

I have designed my job like below which shows result as NULL. I am sure my tExtractjsonFields is not configured properly.

 

0683p000009M134.png

 

Trying to extract Json (as shown below) using URL:

 

[
  {
    "assignment_id": 1234,
    "title": "Assignment 1",
    "points_possible": 10,
    "due_at": "2012-01-25T22:00:00-07:00",
    "unlock_at": "2012-01-20T22:00:00-07:00",
    "muted": false,
    "min_score": 2,
    "max_score": 10,
    "median": 7,
    "first_quartile": 4,
    "third_quartile": 8,
    "module_ids": [
        1,
        2
    ],
    "submission": {
      "submitted_at": "2012-01-22T22:00:00-07:00",
      "score": 10
    }
  },
  {
    "assignment_id": 1235,
    "title": "Assignment 2",
    "points_possible": 15,
    "due_at": "2012-01-26T22:00:00-07:00",
    "unlock_at": null,
    "muted": true,
    "min_score": 8,
    "max_score": 8,
    "median": 8,
    "first_quartile": 8,
    "third_quartile": 8,
    "module_ids": [
        1
    ],
    "submission": {
      "submitted_at": "2012-01-22T22:00:00-07:00"
    }
  }
]

 My tExtractJsonFields is configred as below:

0683p000009M139.png

 

Can someone please guide what am I doing wrong?

 

Thanks

Harshal.

 

Labels (4)
48 Replies
Parikhharshal
Creator III
Creator III
Author

@rhall: and @CK395: I have got my json data output for second scenario using java like this:

Date Instructor message student message
Date1 1 2
Date2 1 1
Date 3 2 2

Is it possible to straight away output it into db?
Anonymous
Not applicable

Yes you can if your java component has schema defined to be inserted into db

then simply connect your data flow to db_output component and configure the db_output with same schema and valid 

configuration of other values  and you are good to go.

 

 

 

 

Regards

Chandra Kant

Parikhharshal
Creator III
Creator III
Author

@CK395 and @rhall: my java is trying to read from file.json just as a test and formatting data the way I want. But I need to plug in same code in flow: trest client- tjava- db output.

How do I read the output of trest client in java (where my existing code will then manipulate the json format)? Is there any method or property you know? This is where I’m stuck as getting the read from file won’t work in my case as I have got parallelism happening later in the flow. So the best way would be to get output read by tjava.

Please help!
Anonymous
Not applicable

hi,

i think tjava cannot provide an output flow to be inserted into db.

you better go for tJavaFlex.

 

 

Regards

Chandra Kant

Parikhharshal
Creator III
Creator III
Author

@CK395 and @rhall: I am really unable to get output read from trest client using javarow or javaflex component.

Currently as a workaround I have got this:

Trest client- toutputjson (creates the output json file) - tjava (which calls routine. This does manipulating of json data and saving into csv file)- tinputdelimeted which will read csv file- output into dB. I’m reluctant to have this workflow as it creates many types of files and given during the process I will create many files. This is not the ideal solution.

Your help is really appreciated if you can show me how to read output result from trest client then that way I don’t have to create json file and instead java component will read rest client output and feed it to csv.

Let me know your thoughts and please share some screenshots.
Anonymous
Not applicable

What column are you reading from after your tRestClient? It should be the String column, not the Body column.

Parikhharshal
Creator III
Creator III
Author

@rhall: yes I know it is string. But what do I write in javarow or javaflex to get entire output as string or object type from trest client? Then I can manipulate in java code later.
Anonymous
Not applicable

Connect your tRestClient to a tJavaFlex and use this code (assuming the row is "row1")....

System.out.println(row1.string);

You should see the JSON from the webservice call printed to the console window now. If not, your tRestClient is not returning anything.

 

It might help to see a screenshot of your job AND a screenshot of your tRestClient's output schema. Sometimes the output schema can become corrupt

Parikhharshal
Creator III
Creator III
Author

@rhall: here there sample json data:

{
"2012-01-24":{
"instructorMessages":1,
"studentMessages":2
},
"2012-01-27":{
"studentMessages":1
}
}

And simple job like this:

Anonymous
Not applicable

This code....

System.out.println(row1.string);

....was to show you how to use the JSON in the tJavaFlex. I don't want to see the JSON. Was what you posted achieved by using the above code?