json:number

Purpose

Represents a JSON number value.

A number value can consist of an optional plus ('+') sign, or minus ('-') sign, followed by a sequence of zero or more decimal digits, optionally followed by a fraction or by an exponent. The fraction can consist of a decimal point followed by zero or more decimal digits. The whole string must contain at least one digit in either the integer or the fraction. The exponent must consist of the character 'e' or 'E' followed by one or more decimal digits.

Contained by

Example

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:mcs="http://www.volantis.com/xmlns/2006/01/xdime/mcs"
  xmlns:json="http://www.volantis.com/xmlns/2009/07/json">
  <head>
    <title>JSON example</title>
  </head>
  <body>
    <div>
      <mcs:script type="text/javascript">
        V$C.starting(function(c){
          var json = c.get('json');
          alert("Value: "+ json.str + ", Type: "+ typeof json.str);
          alert("Value: "+ json.num + ", Type: "+ typeof json.num);
          alert("Value: "+ json.bool + ", Type: "+ typeof json.bool);
          alert("Value: "+ json.nil + ", Type: "+ typeof json.nil);
        });
      </mcs:script>
      <json:inline id="json">
        <json:object>
          <json:property name="str">
            <json:string>String</json:string>
          </json:property>
          <json:property name="num">
            <json:number>5.5</json:number>
          </json:property>
          <json:property name="bool">
            <json:boolean>true</json:boolean>
          </json:property>
          <json:property name="nil">
            <json:null/>
          </json:property>
        </json:object>
      </json:inline>
    </div>
  </body>
</html>

Related topics