Recently we need to fetch a big dataset from an API via powershell, then import to Azure Data Explorer (ADX).
Problem
1 | #Used Measure-Command for measuring performance |
The data.json file looks perfectly fine, but during import to ADX, it reported error “invalid json format”.
Troubleshooting
Using online validation tool such as https://jsonlint.com/, copy & paste the content from data.json. The json objects are valid.
Using local tool jsonlint, reports error. It shows the data.json file has encoding issue.
1 | PS C:\Users\lufeng\Desktop> jsonlint .\data.json |
Solution
Switch to a different powershell command solved the problem
1 | Invoke-WebRequest -Uri 'THE_API_END_POINT' -OutFile data.json |
EOF