A simple parser from JSON string to Dictionary A simple parser from JSON string to Dictionary json json

A simple parser from JSON string to Dictionary


System.Json might do the trick for you.

The JsonValue.Parse() Method parses JSON text and returns a JsonValue like

JsonValue value = JsonValue.Parse(@"{ ""name"": ""David"" }");

You can also have a look at The JavaScriptSerializer class is used internally by the asynchronous communication layer to serialize and deserialize the data that is passed between the browser and the Web server.

var Names = new JavaScriptSerializer().Deserialize<YourNameClass>(json);


OK I found one! https://github.com/zanders3/json

Has decent tests, minimal features and likely designed for my specific use case.

To load a JSON file:

Dictionary<string, object> locales = new Dictionary<string, object>();TextAsset file = Resources.Load(name) as TextAsset;var locale = file.text.FromJson<object>();locales.Add(name, locale);

To use the JSON dictionary:

string activeLocale = "en-US";var locale = locales[activeLocale] as Dictionary<string, object>;var translation = locale[key] as string;

Dead simple.