I have a json which is like [{}, {}, {}]
, i.e. there can be multiple rows and each row has a number of property - value pairs, which remain fixed for each row.
@json =
EXTRACT MainId string, Details string
FROM @INPUT_FILE
USING new Microsoft.Analytics.Samples.Formats.Json.JsonExtractor();
This gives me json as a string.
I don't know how to get: row[3].property4
things like a property's value of a given row. Complicating things the properties are all themselves arranged as {Name: "XXX", Value: "YYY"}
@jsonnodes =
SELECT JsonApp.JsonFunctions.JsonTuple(@json, "event", "id") AS json_map
FROM @json;
Now, the above query I tried but it did not work.
It gives me the error:
Rowset variable '@json' is not a scalar variable.
How could I get row-property pairs and put them in a csv file or table?
Thanks for your help.
The JSON looks like:
[{"MainId":"24201803","System":[{"Name":"event","Value":"S"},{"Name":"id","Value":""}],
"Details":[{"Name":"EventName","Value":"W"},{"Name":"previd","Value":"88"}],
"ttl":8640000}, ....Multiple Rows of the Same type as before....]
The output I am trying to get is:
Table Columns = MainId | System.event | System.id | Details.EventName | Details.previd | ttl
The table's rows' values will be filled by rows having the corresponding property's values (as in the json rows).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…