2

I serialize with Newtonsoft and store the data in Redis. I want to shorten the property names to reduce the size of the data, because my property names are too long and there is too much data.

Example:

{ User:{ UserFullNameBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBla: "blabla" } } 

but I want it to be like this; short property names.

{ User:{ SHRTNM1: "blabla" } } 

I don't use [JsonProperty("name")] because there are too many classes and they're not mine. Anybody have the idea how can I do this?

1 Answer 1

1

Maybe https://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_Serialization_IContractResolver.htm is what are you looking for.

It allows you to customize almost every aspect of how a .NET object gets serialized to JSON, including changing serialization behavior at runtime.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.