JamesNK / Newtonsoft.Json

Json.NET is a popular high-performance JSON framework for .NET
https://www.newtonsoft.com/json
MIT License
10.82k stars 3.26k forks source link

Any plan for new custom type? I would like to suggest geolocation and reference #1554

Closed Thaina closed 6 years ago

Thaina commented 6 years ago

NewtonSoft support unconventional JSON type in C# and I think it's great

But I would like to have more type support. At least geopoint and reference to match with google protobuf. And so it would be easier to bridge things between Json in C# and ProtoBuf when use google service

Especially geopoint I think this type is common nowaday

I had written conversion function with google protobuf for firestore Google.Cloud.Firestore.V1Beta1/Document.cs#L561. It almost map perfectly except these 2 types

geopoint is just latitude/longitude and reference is just special string to keep key of any format

I think we may hack the key to use uri type. But geopoint was really needed to handle

ps. This is my bridge code

https://gist.github.com/Thaina/82071ca2814755ef3571fec352f2e44c

JamesNK commented 6 years ago

It can be part of a third party NuGet package. There is no reason it needs to be inside Newtonsoft.Json

Thaina commented 6 years ago

@JamesNK Sure it can be 3rd party. But I think it should be part of NewtonSoft

3rd party cannot extend enum JTokenType. What I want is JTokenType.Geo or something like that