This is my input JSON file.
[
{
"Tag": "STACK007",
"data": [
{
"item": "UNIFY109",
"timestamp": "2018-08-27T17:28:51.8490000Z",
"jsonVersion": 1,
"messageType": 1,
"velocity": 709
}
],
"EventProcessedUtcTime": "2018-08-27T17:36:17.5519639Z",
"EventEnqueuedUtcTime": "2018-08-27T17:28:52.0010000Z"
}
]
I'm trying to convert this input JSON file to CSV. Here's my U-SQL Script
REFERENCE ASSEMBLY [Newtonsoft.Json];
REFERENCE ASSEMBLY [Microsoft.Analytics.Samples.Formats];
USING Microsoft.Analytics.Samples.Formats.Json;
DECLARE @input string = @"/demodata/logs/2018/08/input.json";
@json =
EXTRACT
Tag string,
EventProcessedUtcTime DateTime,
EventEnqueuedUtcTime DateTime,
JsonFunctions.JsonTuple(data) AS data
FROM @input
USING new JsonExtractor();
@result =
SELECT Tag,
address["velocity"]AS Velocity,
address["messageType"]AS MessageType,
address["timestamp"]AS Timestamp
FROM @json;
OUTPUT @result
TO "/output/demooutput.csv"
USING Outputters.Csv();
This script is giving me a syntax error with the message "syntax error. Expected one of: '.' "
How do I fix this?