docs: record the JSON type a numeric attribute takes on each read path - #21
Merged
Conversation
There was a problem hiding this comment.
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.
robrigo
force-pushed
the
docs/numeric-values-in-json
branch
from
August 21, 2026 19:01
8174b5a to
da71e90
Compare
There was a problem hiding this comment.
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
Float32and the shortest number string forFloat64, 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.
robrigo
force-pushed
the
docs/numeric-values-in-json
branch
from
August 21, 2026 20:44
da71e90 to
6841da9
Compare
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
force-pushed
the
docs/numeric-values-in-json
branch
from
August 21, 2026 22:19
6841da9 to
73202c3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/antelopefollows 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()istoFixed(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.mdis 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 adoubleattribute and"market_fee":0.07for the collection in the same body, a template read answering"version":1for adoubleattribute, and an AtomicHub read answering"market_fee":"0.05"insidecollection.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.mjsandmarkdownlint-cli2are clean.