Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

json string to JObject object c# camelCasing key .net

// Construct a JObject.
var jObject = JObject.Parse("{ SomeName: "Some value" }");

// Deserialize the object into an ExpandoObject (don't use object, because you will get a JObject).
var payload = JsonConvert.DeserializeObject<ExpandoObject>(jObject.ToString());

// Now you can serialize the object using any serializer settings you like.
var json = JsonConvert.SerializeObject(payload, new JsonSerializerSettings
{
    ContractResolver = new DefaultContractResolver
    {
        NamingStrategy = new CamelCaseNamingStrategy
        {
            // Important! Make sure to set this to true, since an ExpandoObject is like a dictionary.
            ProcessDictionaryKeys = true,
        }
    }
}
);

Console.WriteLine(json); // Outputs: {"someName":"Some value"}
Comment

PREVIOUS NEXT
Code Example
Csharp :: conveyor function in f# 
Csharp :: how to make a methode accessible from all the forms c# 
Csharp :: Post and Pre Increment operators in C# 
Csharp :: stateteach.net 
Csharp :: csharp functions 
Csharp :: ASP.NET Core set update clear cache from IMemoryCache (set by Set method of CacheExtensions class) 
Csharp :: eager loading singleton c# dependency injection 
Csharp :: c# changimg to one decimal place 
Csharp :: Delegates in UntiyC# 
Csharp :: hacking 
Csharp :: how to write an if statement with two checkboxes in c# 
Csharp :: c# string to control name 
Csharp :: c# compare char arrays 
Csharp :: sqldatareader get row count 
Csharp :: net use error 67 
Csharp :: multiple lines in string c# parameterized 
Csharp :: changing color of material of renderer with multiple materias 
Csharp :: how to use javascriptexecutor for loop in selenium c# 
Csharp :: list remove positions c# 
Csharp :: c# reflection 
Csharp :: how to round in c# 
Csharp :: swagger skip endpoint .net core 
Csharp :: get index of item unity 
Csharp :: unity public script 
Csharp :: stackpanel opacity mask from resources wpf 
Csharp :: call action method on checkbox click asp.net mvc without pageload 
Html :: font awesome icon for email 
Html :: jqury get selected option 
Html :: how to specify amout of letters in inputfield in css 
Html :: html disable enter submit 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =