All Projects → zanders3 → Json

zanders3 / Json

Licence: mit
A really simple C# JSON Parser in 350 lines

Projects that are alternatives of or similar to Json

Fo Dicom
Fellow Oak DICOM for .NET, .NET Core, Universal Windows, Android, iOS, Mono and Unity
Stars: ✭ 674 (+233.66%)
Mutual labels:  unity-3d, nuget
JsonFormatter
Easy, Fast and Lightweight Json Formatter. (Serializer and Deserializer)
Stars: ✭ 26 (-87.13%)
Mutual labels:  unity-3d, json-parser
Unity resources
A list of resources and tutorials for those doing programming in Unity.
Stars: ✭ 170 (-15.84%)
Mutual labels:  unity-3d
Viewfacecore
C# 超简单的人脸识别库。
Stars: ✭ 193 (-4.46%)
Mutual labels:  nuget
Liget
NuGet server and cache running on kestrel in docker
Stars: ✭ 177 (-12.38%)
Mutual labels:  nuget
Rimlight
Customizable rimlight shader for Unity that includes pulsation and noise scrolling. Give your scenes that extra oomph!
Stars: ✭ 170 (-15.84%)
Mutual labels:  unity-3d
Dlib
Allocators, I/O streams, math, geometry, image and audio processing for D
Stars: ✭ 182 (-9.9%)
Mutual labels:  json-parser
Monogame.forms
MonoGame.Forms is the easiest way of integrating a MonoGame render window into your Windows Forms project. It should make your life much easier, when you want to create your own editor environment.
Stars: ✭ 165 (-18.32%)
Mutual labels:  nuget
Sleet
A static nuget feed generator for Azure Storage, AWS S3, and more.
Stars: ✭ 201 (-0.5%)
Mutual labels:  nuget
Owin Webapi Service
✅ OWIN / WebAPI windows service example. Includes attribute based routing sample
Stars: ✭ 175 (-13.37%)
Mutual labels:  nuget
Unity Ecs Rts
Trying to recreate a simple RTS game using Unity and pure ECS
Stars: ✭ 189 (-6.44%)
Mutual labels:  unity-3d
Cognitive Face Windows
Windows SDK for the Microsoft Face API, part of Cognitive Services
Stars: ✭ 175 (-13.37%)
Mutual labels:  nuget
Goldeneye
The CQRS flavoured framework that will speed up your WebAPI and Microservices development
Stars: ✭ 171 (-15.35%)
Mutual labels:  nuget
Fluentvalidation
A library for using FluentValidation with Blazor
Stars: ✭ 184 (-8.91%)
Mutual labels:  nuget
Mqttnet
MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
Stars: ✭ 2,486 (+1130.69%)
Mutual labels:  nuget
Bridge
♠️ C# to JavaScript compiler. Write modern mobile and web apps in C#. Run anywhere with Bridge.NET.
Stars: ✭ 2,216 (+997.03%)
Mutual labels:  nuget
Html2markdown
A library for converting HTML to markdown syntax in C#
Stars: ✭ 167 (-17.33%)
Mutual labels:  nuget
Web Database Analytics
Web scrapping and related analytics using Python tools
Stars: ✭ 175 (-13.37%)
Mutual labels:  json-parser
Jsons
🐍 A Python lib for (de)serializing Python objects to/from JSON
Stars: ✭ 178 (-11.88%)
Mutual labels:  json-parser
Log4net.elasticsearch
log4net appender to ElasticSearch
Stars: ✭ 202 (+0%)
Mutual labels:  nuget

Tiny Json

Build Status License NuGet

A really simple C# JSON parser in ~350 lines

  • Attempts to parse JSON files with minimal GC allocation
  • Nice and simple "[1,2,3]".FromJson<List<int>>() API
  • Classes and structs can be parsed too!
class Foo 
{ 
  public int Value;
}
"{\"Value\":10}".FromJson<Foo>()
  • Anonymous JSON is parsed into Dictionary<string,object> and List<object>
var test = "{\"Value\":10}".FromJson<object>();
int number = ((Dictionary<string,object>)test)["Value"];
  • No JIT Emit support to support AOT compilation on iOS
  • Attempts are made to NOT throw an exception if the JSON is corrupted or invalid: returns null instead.
  • Only public fields and property setters on classes/structs will be written to
  • You can optionally use [IgnoreDataMember] and [DataMember(Name="Foo")] to ignore vars and override the default name

Limitations:

  • No JIT Emit support to parse structures quickly
  • Limited to parsing <2GB JSON files (due to int.MaxValue)
  • Parsing of abstract classes or interfaces is NOT supported and will throw an exception.

Changelog

  • v1.1 Support added for Enums and fixed Unity compilation
  • v1.0 Initial Release

Example Usage

This example will write a list of ints to a File and read it back again:

using System;
using System.IO;
using System.Collections.Generic;

using TinyJson;

public static class JsonTest
{
  public static void Main(string[] args)
  {
    //Write a file
    List<int> values = new List<int> { 1, 2, 3, 4, 5, 6 };
    string json = values.ToJson();
    File.WriteAllText("test.json", json);
    
    //Read it back
    string fileJson = File.ReadAllText("test.json");
    List<int> fileValues = fileJson.FromJson<List<int>>();
  }
}

Save this as JsonTest.cs then compile and run with mcs JsonTest.cs && mono JsonTest.exe

Installation

Simply copy and paste the JSON Parser and/or the JSON Writer into your project. I also provide NuGet but I recommend the copy paste route ;)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].