Home > OS >  json syntax error , Expecting 'EOF', '}', ',', ']', got 
json syntax error , Expecting 'EOF', '}', ',', ']', got 

Time:10-10

I have a JSON literal string that I have handwritten, and want to load to memory via Python's json() library,however it seems my json has syntax error based online validator(https://jsonbeautifier.org/):

Error: Parse error on line 43:
...": "var_val"     }   } //end stats object}
---------------------^
Expecting 'EOF', '}', ',', ']', got 'undefined'

My JSON:

   {
        "stats": {
            "a": {
                "min": "min_val",
                "max": "max_val",
                "avg": "avg_val",
                "median": "median_val",
                "range": "range_val",
                "skew": "skew_val",
                "kurtosis": "kurtosis_val",
                "var": "var_val"
            },
            "av": {
                "min": "min_val",
                "max": "max_val",
                "avg": "avg_val",
                "median": "median_val",
                "range": "range_val",
                "skew": "skew_val",
                "kurtosis": "kurtosis_val",
                "var": "var_val"
            },
            "b": {
                "min": "min_val",
                "max": "max_val",
                "avg": "avg_val",
                "median": "median_val",
                "range": "range_val",
                "skew": "skew_val",
                "kurtosis": "kurtosis_val",
                "var": "var_val"
            },
            "bv": {
                "min": "min_val",
                "max": "max_val",
                "avg": "avg_val",
                "median": "median_val",
                "range": "range_val",
                "skew": "skew_val",
                "kurtosis": "kurtosis_val",
                "var": "var_val"
            }
        } //end stats object
    } //end json 

Basically, there is an object called "stats", that has 4 child objects called a,av,b,bv and each of those has attributes min,max,etc..

How can I fix this json?

CodePudding user response:

JSON format doesn't support comments. If you remove them, it'll work fine.

  •  Tags:  
  • json
  • Related