So, I am trying to load a JSON file into Python and I am getting the following error:
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes
My JSON file (the beginning thereof) looks like this:
{
//Deploy to http://localhost:9200/_template/cwmp_genieacs
"!deploy_to": "cwmp_genieacs",
"index_patterns" : ["cwmp_genieacs_*"],
"version": 180201, // Increase this with every release
"order" : 9999999, // Decrease this with every release
"mappings": {
"cwmp_genieacs": {
"properties": {
"@timestamp": { "type": "date", "format": "strict_date_optional_time||epoch_millis" },
"FactoryReset": {"type": "date"},
"InternetGatewayDevice.Capabilities.PerformanceDiagnostic.DownloadTransports": {"type": "keyword"},
"InternetGatewayDevice.Capabilities.PerformanceDiagnostic.UploadTransports": {"type": "keyword"},
"InternetGatewayDevice.CrashDiagnostics.Action": {"type": "keyword"},
Now, I understand what the problem is. The first few lines aren't in the correct JSON format. When I delete them and start at "mappings" it works fine. But I need to load the JSON file without editing the file. So, are there any solutions?
For the first line (the one that starts with "//") I could maybe use the startswith() function but I don't know what to do with the two lines that start with "version": 180201 and "order" : 9999999.
I am using Python 3.6.