Skip to content

Conversation

@arendvw
Copy link
Contributor

@arendvw arendvw commented Dec 23, 2025

Since cityjson files tend to be huge and system.text.json promises to be more performant in many places, here's a refactor of the code that uses system.text.json.

At this point, all unit tests run ok, but there are breaking changes in the api or usage.

Most prominently:

  • System.Text.JSON is case sensitive by default, and Newtonsoft is not
  • Decoding requires non-case sensitivity passed as options
  • Marking things as required has a different impact

TODO:

  • Benchmarking to see if it actually matters
  • More thorough testing.

So the main question: is System.Text.Json interesting to you as well? There were also other clear reasons, upstream or downstream, to choose Newtonsoft.Json over stj.

Happy holidays!

- Updated to .netstandard 2.0 for cityjson
- Added small fix for net48 compatiblity in cj2glb.csproj
- Note: cj2glb is not compatible with net48 because of signing issues with SharpGLTF and AnyOf (SharpGLTF is signed, AnyOf is not), but the code on this project's side is fully compatible if built against a locally checked out Gltf project
System.Text.JSON behaves a bit differently and does not allow global overrides, so deserialization should be done with CityJsonSystemTextJson.Options.

All tests run completely, but there might be other trouble.
@bertt
Copy link
Owner

bertt commented Dec 23, 2025

yes interested in this, I shall add a basic benchmark test so we can do a comparison

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