Are decimals without leading zeros valid JSON?

前端 未结 2 819
陌清茗
陌清茗 2020-12-18 23:36

Given the JSON document

{\"percentageAmount\": .01}

Running it by JSONLint.com results in the error:

Parse error on line 2:         


        
2条回答
  •  情深已故
    2020-12-19 00:10

    Nope.

    According to the railroad diagram for numbers at JSON.org, numbers with fractional values must have digits before the decimal point:

    Diagram showing that numbers with fraction parts must have a digit before the decimal point.

提交回复
热议问题