Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# create dynamic json

[TestFixture]
public class DynamicJson
{
    [Test]
    public void Test()
    {
        dynamic flexible = new ExpandoObject();
        flexible.Int = 3;
        flexible.String = "hi";

        var dictionary = (IDictionary<string, object>)flexible;
        dictionary.Add("Bool", false);

        var serialized = JsonConvert.SerializeObject(dictionary); // {"Int":3,"String":"hi","Bool":false}
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# how to call a method from another class 
Csharp :: how to convert float to int c# 
Csharp :: npm install --save vue-route@n 
Csharp :: doing void when gameobject setactive unity 
Csharp :: c# regex find number in string 
Csharp :: how to start a webpage from a button c# 
Csharp :: How to take input on float in c# 
Csharp :: wpf mouse over style trigger 
Csharp :: jagged array c# 
Csharp :: find character from string c# count 
Csharp :: how to get the transform of an object in unity 
Csharp :: c# last char in string 
Csharp :: ef rollback migration 
Csharp :: array sorting c# 
Csharp :: how to rotate object in unity only on one axis 
Csharp :: dns ttl meaning 
Csharp :: how to create empty text file in c# 
Csharp :: how to save a dictionary as a csv file in c# 
Csharp :: C# loop through array of objet 
Csharp :: dictionary in c# unity 
Csharp :: c# readline char 
Csharp :: c# unescape string 
Csharp :: wpf toolbar disable overflow 
Csharp :: use raycast unity new input system 
Csharp :: c# video to frames 
Csharp :: how do you make a 2D object follow another 2D object in unity 2D 
Csharp :: c# csvhelper 
Csharp :: what is a model in c# 
Csharp :: pyautogui not odwnloading 
Csharp :: c# string to bool 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =