add: ordered_json support, tests for the new functionality - #78
Open
Griger5 wants to merge 1 commit into
Open
Conversation
Griger5
marked this pull request as ready for review
August 9, 2026 16:29
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.
Hello.
This PR enables support for
nlohmann::ordered_jsonobjects, thus it closes the 3 year old issue #63.ordered_jsonimplementation of the caster is included in a seperate header file to avoid unnecessary compilation for the end-user. However, with this approach there is a copy-paste problem, since the ordered implementation is virtually the exact same.It can be abstracted with templates, you can check out how I did it in my fork of
nanobind_jsonhere: https://github.com/Griger5/nanobind_json/blob/main/include/nanobind_json/nanobind_json.h#L28If you think the template version is better, please let me know.
A suite of seperate tests is also included, all of the regular json tests + two for checking the order.
Let me know if anything else needs addressing, hoping for a merge :)