Hello,

Is it part of the spec that numbers in the “basic” JSON representation (of 7+ 
digits) be serialized using scientific notation? For example:

let $direct := <json type="object"><n type="number">1339029</n></json>
let $basic := <fn:map><fn:number key="n">1339029</fn:number></fn:map>
let $result := ($direct, $basic) ! serialize(., map {
    "method": "json", "json": map {
      "format": if (position() eq 1) {"direct"} else {"basic"}, "indent": "yes"
    }
  })
return $result

…produces two different results:

{
  "n":1339029
}
{
  "n":1.339029E6
}

I usually prefer working with the “basic” format, but the automatic conversion 
to scientific notation is inconvenient because the value is not easily castable 
as an xs:integer.

Thanks in advance,
Tim


--
Tim A. Thompson (he, him)
Librarian for Applied Metadata Research
Yale University Library
www.linkedin.com/in/timathompson<http://www.linkedin.com/in/timathompson>
timat...@protonmail.com<mailto:timothy.thomp...@yale.edu>

Reply via email to