[SOLVED] Json data generated from PowerShell could not be read from Hugo

#1

I have a json data exported using PowerShell but, it could not be read from Hugo templates. Getting an error while building site like “invalid character ‘ï’ looking for beginning of value”. Can any one had this issue before. Please help me out.
While troubleshooting I understood that the json content inside the file is in correct structure but the file could not be read by the Hugo compiler. Below is the json structure exported using PowerShell’s ConvertTo-Json method:

[
    {
        "x":  "text",
        "y":  1,
        "z":  1,
        "a":  "001",
        "b":  "text"
    },
        {
        "x":  "text",
        "y":  1,
        "z":  1,
        "a":  "001",
        "b":  "text"
    }
]

($DataSet.Tables[0] | select $DataSet.Tables[0].Columns.ColumnName ) | ConvertTo-Json -Depth 2| Out-File "C:\HugoDataExport\1.json " -Encoding utf8 -Force , This is the code used to genertate json from PowerShell.

#2

Please read Requesting Help and edit your post with more information. Then someone should be able to assist. :slight_smile:

#4

Does the file have Windows line endings? Not all tools like those.

#5

It was due to the different utf8 encoding that windows used.