I have a JSON schema that I get from the server and I need to transform this JSON into a log analytics query language table and use that table to make a join with another table.
The JSON has the following schema:
[{
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
}, {
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
}]
I tried this :
let table = todynamic('[{
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
}, {
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
]');
But this does not convert the JSON into something that can be used in a join with other tables.
Any help will be very appreciated.
try using print
and dynamic
:
print myDynamicValue = dynamic([{
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
}, {
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
}])
| mvexpand myDynamicValue // this line is just an example
Update (based on question in comments):
let result =
print myDynamicValue = dynamic(
[
{ "X": "xyz", "Y": "xyz", "Z": "xyz", "prop1": "value1", "prop2": "value2", "prop3": "value3" },
{ "X": "xyz", "Y": "xyz", "Z": "xyz", "prop1": "value1", "prop2": "value2", "prop3": "value3" }
])
| mvexpand myDynamicValue
| evaluate bag_unpack(myDynamicValue);
result