Skip to content

docs: record the JSON type a numeric attribute takes on each read path - #21

Merged
robrigo merged 1 commit into
mainfrom
docs/numeric-values-in-json
Aug 21, 2026
Merged

docs: record the JSON type a numeric attribute takes on each read path#21
robrigo merged 1 commit into
mainfrom
docs/numeric-values-in-json

Conversation

@robrigo

@robrigo robrigo commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Why

Nothing in the corpus said what JSON type a numeric attribute value takes, and the answer is not one type. nodeos prints every float as a quoted decimal string of the widened double, @wharfkit/antelope follows the same convention, and the hosted APIs answer a JSON number, except on values that reached the database through the ABI action path, where the indexer objectified the string form and stored it. A reader written against one path and pointed at another reads the right value at the wrong type.

The page also records where the node's convention loses information. Float32.toString() is toFixed(7), which keeps seven decimal places where a float32 carries about seven significant digits, so a value needing more than seven fractional decimals cannot be read back, and two adjacent float32 values above 0.5 print alike.

The page sits at the reference root rather than under reference/atomicassets/, because none of its facts are contract facts and it covers AtomicMarket fee fields as well. reference/media.md is the precedent for a root-level page that spans layers.

Validation

Every claim carries a source line naming a live read or the library source. Three reads were run for this page and reproduce: an AtomicAssets asset read answering "Strength":"170.7" for a double attribute and "market_fee":0.07 for the collection in the same body, a template read answering "version":1 for a double attribute, and an AtomicHub read answering "market_fee":"0.05" inside collection.extended_attributes. The path rule is read off those responses rather than off indexer source, which the ledger row states. check-frontmatter.mjs, check-validation-consistency.mjs and markdownlint-cli2 are clean.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds reference guidance for numeric JSON representations across chain, SDK, and hosted API read paths.

Changes:

  • Documents float and 64-bit integer JSON types and float32 precision loss.
  • Adds validation records, routing, and serialization cross-reference.
  • Records the addition in the README and changelog.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
reference/numeric-values-in-json.md Adds the numeric JSON type reference.
reference/validation.md Records sources, versions, and validation evidence.
reference/atomicassets/serialization.md Links decoding guidance to the new reference.
AGENTS.md Adds outcome-based routing to the page.
README.md Lists numeric JSON types in repository coverage.
CHANGELOG.md Records the new documentation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread reference/atomicassets/serialization.md Outdated
Comment thread reference/numeric-values-in-json.md Outdated
Comment thread reference/numeric-values-in-json.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread reference/numeric-values-in-json.md Outdated
Comment thread reference/numeric-values-in-json.md Outdated
@robrigo
robrigo requested a balanced review from Copilot August 21, 2026 19:01
@robrigo
robrigo force-pushed the docs/numeric-values-in-json branch from 8174b5a to da71e90 Compare August 21, 2026 19:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Suppressed comments (1)

reference/numeric-values-in-json.md:47

  • Only the JSON type matches nodeos; the textual values are not “exactly” the same. Nodeos is described above as widening to 17 fixed places, while WharfKit uses 7 fixed places for Float32 and the shortest number string for Float64, so consumers can receive different text and float32 round-trip behavior.
`@wharfkit/antelope` follows the node's convention rather than the one the hosted APIs use. `Float32.toString()` returns `value.toFixed(7)`, `Float64.toString()` returns `value.toString()`, and `Float.toJSON()` returns that string, so `Serializer.objectify` yields a string for both widths. Code that decodes a chain response through the library and hands the objectified result to application code is handing it strings, exactly as a raw nodeos read would.

Comment thread reference/numeric-values-in-json.md Outdated
Comment thread reference/numeric-values-in-json.md Outdated
Comment thread reference/validation.md Outdated
Comment thread reference/sdk/atomicmarket.md Outdated
Comment thread CHANGELOG.md Outdated
@robrigo
robrigo force-pushed the docs/numeric-values-in-json branch from da71e90 to 6841da9 Compare August 21, 2026 20:44
@robrigo
robrigo deployed to wax-testnet August 21, 2026 20:44 — with GitHub Actions Active
A reader that decodes a chain response through @wharfkit/antelope and a
reader that calls a hosted API receive different JSON types for the same
stored value, and nothing in the corpus said so. In the raw get_table_rows
body nodeos prints every float as a quoted decimal string of the widened
double, the client library follows that convention, and the hosted APIs
answer a number, except on values that reached the database through the ABI
action path, where the indexer objectified the string form and stored it.

The float32 half of that convention loses information: toFixed(7) keeps
seven decimal places where a float32 carries about seven significant digits,
so a value needing more than seven fractional decimals cannot be read back,
and the two float32 values one and two units above 0.5 print alike. A short
decimal literal survives, which is why the measured failure rates are stated
as sample rates rather than as bounds on a decade.

Every claim is cited to a live read or to the library source. The path rule
comes from four responses rather than from indexer source, which the ledger
row states, as does the discrepancy between the SDK page's declared numeric
widths and the quoted decimal a raw table read answers.
@robrigo
robrigo force-pushed the docs/numeric-values-in-json branch from 6841da9 to 73202c3 Compare August 21, 2026 22:19
@robrigo
robrigo deployed to wax-testnet August 21, 2026 22:19 — with GitHub Actions Active
@robrigo
robrigo merged commit 1fc82df into main Aug 21, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants