Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8542075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:58:37+00:00 2026-06-11T11:58:37+00:00

I am using Newtonsoft’s JSON.NET library to serialize some objects. In particular, I want

  • 0

I am using Newtonsoft’s JSON.NET library to serialize some objects. In particular, I want to store NetTopologySuite Point classes (or GeoAPI IPoint interfaces) as properties on my objects.

I only want to store a latitude and longitude property in my resulting JSON. In contrast, IPoint has X, Y, Z, and several other properties.

Can I somehow inject my own logic for how to serialize/deserialize this particular type to/from JSON?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:58:38+00:00Added an answer on June 11, 2026 at 11:58 am

    For this sort of operation, I always look at TweetSharp and how it handles it.

    For example, TweetSharp uses a TwitterGeoConverter.cs to serialise/deserialise the TwitterGeoLocation.GeoCoordinates type to/from JSON:
    https://github.com/danielcrenna/tweetsharp/blob/master/src/net40/TweetSharp.Next/Serialization/Converters/TwitterGeoConverter.cs

    The key methods in this converter are:

    • CanConvert – should this converter be used on this member
    • WriteJson – handles the object to string output
    • ReadJson – handles the string to object parsing

    The converters themselves are registered with JSON.Net using JsonSerializerSettings – e.g:

    new JsonSerializerSettings
                       {
                           MissingMemberHandling = MissingMemberHandling.Ignore,
                           NullValueHandling = NullValueHandling.Ignore,
                           DefaultValueHandling = DefaultValueHandling.Include,
                           ContractResolver = new JsonConventionResolver(),
                           Converters = new List<JsonConverter>
                                            {
                                                new TwitterDateTimeConverter(),
                                                new TwitterWonkyBooleanConverter(),
                                                new TwitterGeoConverter()
                                            }
                       })
    

    (from https://github.com/danielcrenna/tweetsharp/blob/master/src/net40/TweetSharp.Next/Serialization/SerializerBase.cs)


    Alternatively, you can also register converters using attributes – see https://github.com/geersch/JsonNetDateTimeConverter


    Or… if the case is very simple and if you own the source code – then if you simply want to ignore some properties during the serialisation, then there is a [JsonIgnore] attribute available for the properties you want to skip.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using JSON.NET implementation to serialize/deserialize .NET objects to JS and vice versa, all
I'm working on a .NET 2.0 C# project using the Newtonsoft.JSON library. When i
I'm using Newtonsoft JSON.NET 4.5r7 in an MVC4 non-api project. Below I rename id
Currently I am using the terrific Linq 2 Json.net (by newtonsoft), which is a
I'm attempting to serialize a class hierarchy in Newtonsoft Json using C#. My class
I'm using the Newtonsoft JSON.NET package to deserialize my responses. This is a sample
I have a working application using Json.NET (newtonsoft) as a custom serializer. Currently I'm
I'm using Newtonsoft.Json to turn json into objects, that works fine. I was wondering
I am using Newtonsoft Json library to parse json but i don't know how
I am using Newtonsoft's Json.NET to deserialize a JSON string: var output = JsonConvert.DeserializeObject<dynamic>({

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.