Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there
I have designed my job like below which shows result as NULL. I am sure my tExtractjsonFields is not configured properly.
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:
Can someone please guide what am I doing wrong?
Thanks
Harshal.
@rhall: This is how my job looks like:
Where tJavaflex looks like this:
Analytics analyticsAPI = new Analytics();
analyticsAPI.parseJsonData(row2.string, (String) globalMap.get("tempFileURI",student_id,sis_user_id,course_id,course_code));
It actually calls routine Analytics and returns the output in .csv file which I am then putting into S3 using PutLadedData. Once this job is successful then another subjob runs and copies all the files from S3 to Redshift using below steps:
Is there anything I can change or seems correct?
hi Parikhharshal,
your json path queries does not seem to be correct as per data provided and the requirement
you better use <"$[*]"> for the loop query.
and then specify the jsonpath for fields.
Regards
Chandra Kant
If you are using Read By JsonPath, please mention the Loop Jsonpath query as below.
If you are using Read By Xpath, please mention the Loop Xpath query as below.
@CK395 and @kharindran:
It works fine. Thanks.
Similarly I have got 2 different scenarios:
Can you please suggest what should be my Loop jSonpath query in tExtractJsonFields?
1.
{ "page_views": { "2012-01-24T13:00:00-00:00": 19, "2012-01-24T14:00:00-00:00": 13, "2012-01-27T09:00:00-00:00": 23 }, "participations": [ { "created_at": "2012-01-21T22:00:00-06:00", "url": "https://canvas.example.com/path/to/canvas", }, { "created_at": "2012-01-27T22:00:00-06:00", "url": "https://canvas.example.com/path/to/canvas", } ] }
2.
{ "2012-01-24":{ "instructorMessages":1, "studentMessages":2 }, "2012-01-27":{ "studentMessages":1 } }
1. The loop Jsonpath query for this case would be $.participations
2. I am not sure about this as there seems no fixed variable name. Will check on this and update you if I find a solution.
Hi,
first of all make your first json file valid,
and since there are no such looping elements thus without looping
for 1 jsonpath query would be :
<"$.pageviews">
<"$.participations[*].created_at">
<"$.participations[*].url">
and for 2 jsonpath query would be
<"$.2012-01-24.instructorMessages">
and similarly for other keys
Regards
Chandra Kant