Search code examples
jsonvisual-studio-code

JSON file error in Visual Studio Code: Expected comma json(514)


I'm having a strange problem with Visual Studio Code. I have the following JSON file that has a problem:

         {
             "attribute": "// numeroConta",
             "operator": "=",
             "value": 0030152201

         }

The problem is accused of "value" in the second number zero. The problem is as follows: Expected commajson (514) I found nothing in my searches. Any idea?


Solution

  • If you want to have leading 0's on the number, you will need to make is a string and enclose it in "

    {
      "attribute": "// numeroConta",
      "operator": "=",
      "value": "0030152201"
    }
    

    Otherwise remove the leading 0's, leading 0's that are not directly followed by a decimal point (i.e. 0.2 is fine) are not seen as numbers in the JSON format, see the StackOverflow issue here.