Saifullah Babrak
Saifullah Babrak

Reputation: 53

Read json with glue crawler return UNKNOWN classification

I have a json file which of following format

{"result": [{"key1":"value1", "key2":"value2", "key3":"value3"}]}

When I use the crawler the table created has classification UNKOWNN. I have done some research and if you make a custom classifier with JsonPath $[*] you should be able to get the whole array. Unfortunately this does not work, for me at least. I created a new crawler after creating the classifier as it would not work if the old crawler were updated with the classifier.

Has anyone run into this issue and can be of help?

Upvotes: 1

Views: 969

Answers (2)

Saifullah Babrak
Saifullah Babrak

Reputation: 53

I found a workaround..

In my python script I select the "result" array. In other words I do not have the "result" key now. I can then use the classifier with following JsonPath $[*]. This workaround worked fine for me.

Have a nice one!

Upvotes: 0

Jon Legendre
Jon Legendre

Reputation: 370

Your JSONPath is assuming that the root is a collection, eg.

[{"result ..},{}]

Since your root is not a collection, try a JSONPath like this:

$.result

That assumes that the whole object is the value you want, you may also want to do:

$.result[*]

That will get each entry in the result collection as a separate object.

Upvotes: 1

Related Questions