I am basically trying to load this json file so that I can loop thorough the versions array, but I am getting the following JSON::ParserError.
{
"key1": "value",
"key1": "value",
"others_legacy_software": [
"value",
"value",
"value"
],
" key1 ": "...",
" key1 ": "...",
" key1 ": "...",
" needed_additional_dataversions": [
"2020",
"2019",
"2018",
"2017"
],
" blahblahblah ": " "
}
I have tried the following:
file = File.open "releaseinfo.json"
data_versions = JSON.load file
file.close
# I want to be able to do the following:
data_versions['needed_additional_dataversions']
# and then loop over the values for some functions
But I am getting the following error
JSON::ParserError
-----------------
795: unexpected token at '��{'
What unexpected token am I seeing? And how can I solve this problem? Been stuck on this for a couple of hours now
EDIT:
function gettagsfromdynamo() {
$table_name = "PC_Deployments"
$dbkey = '{"ReleaseId":{"AttributeValueList":[ {"N":"1"} ],"ComparisonOperator": "EQ"}}' | ConvertTo-Json -Compress
$dbvalue = aws dynamodb query --table-name $table_name --key-conditions $dbkey --region $region
$latest_tags = $dbvalue | ConvertFrom-Json
$latest_tags
}
$db_tags = gettagsfromdynamo
$db_tags.Items.Tags.S | Out-File -FilePath releaseinfo.json
unexpected token at '��{'then I am pretty sure that your JSON file is not UTF-8 encoded but was saved in any other encoding. Where did you get that JSON from? How was it created?