Skip to content

stdlib: document float map key encoding in json#11252

Open
mjc wants to merge 1 commit into
erlang:masterfrom
mjc:mjc/json-float-map-key-test
Open

stdlib: document float map key encoding in json#11252
mjc wants to merge 1 commit into
erlang:masterfrom
mjc:mjc/json-float-map-key-test

Conversation

@mjc

@mjc mjc commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

The json encoder has accepted Erlang maps with float keys since the original json module was added in 66a771e (Add json module). The runtime key dispatcher already handles floats with key(Key, _Encode) when is_float(Key) -> [$", encode_float(Key), $"], which emits the key as a JSON object name.

JSON object names are strings, so this does not add non-string keys to JSON. It updates the public encode_map/1 type and the encode/1 data mapping table to describe the existing Erlang input behavior, and adds encode tests for both the default and checked map encoding paths.

@CLAassistant

CLAassistant commented Jun 16, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

CT Test Results

    2 files    100 suites   1h 0m 23s ⏱️
2 299 tests 2 247 ✅ 52 💤 0 ❌
2 718 runs  2 662 ✅ 56 💤 0 ❌

Results for commit 8a59d51.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@mjc mjc force-pushed the mjc/json-float-map-key-test branch from 1b87bbe to 8a59d51 Compare June 16, 2026 17:35
@mjc

mjc commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

force push: I had accidentally had 2 commits which is silly for a mostly-documentation pr.

@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team:PS Assigned to OTP team PS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants