All Projects → peheje → Jsonserializerswift

peheje / Jsonserializerswift

Licence: mit
A simple Json Serializer for Swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Jsonserializerswift

Panko serializer
High Performance JSON Serialization for ActiveRecord & Ruby Objects
Stars: ✭ 266 (+245.45%)
Mutual labels:  json-serialization
Python Rapidjson
Python wrapper around rapidjson
Stars: ✭ 417 (+441.56%)
Mutual labels:  json-serialization
Jsondoc
JSON object for Delphi based on IUnknown and Variant
Stars: ✭ 20 (-74.03%)
Mutual labels:  json-serialization
Surging
Surging is a micro-service engine that provides a lightweight, high-performance, modular RPC request pipeline. The service engine supports http, TCP, WS,Grpc, Thrift,Mqtt, UDP, and DNS protocols. It uses ZooKeeper and Consul as a registry, and integrates it. Hash, random, polling, Fair Polling as a load balancing algorithm, built-in service gove…
Stars: ✭ 3,088 (+3910.39%)
Mutual labels:  json-serialization
Restc Cpp
Modern C++ REST Client library
Stars: ✭ 371 (+381.82%)
Mutual labels:  json-serialization
Fastjson
A fast JSON parser/generator for Java.
Stars: ✭ 23,997 (+31064.94%)
Mutual labels:  json-serialization
JSON
Simple and easy JSON parser, JSON generator, and data holder based on JSONArray and JSONObject for android
Stars: ✭ 78 (+1.3%)
Mutual labels:  json-serialization
Mongoengine Goodjson
More human-readable json serializer/deserializer for MongoEngine
Stars: ✭ 56 (-27.27%)
Mutual labels:  json-serialization
Jsoncons
A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON
Stars: ✭ 400 (+419.48%)
Mutual labels:  json-serialization
Spray Json
A lightweight, clean and simple JSON implementation in Scala
Stars: ✭ 917 (+1090.91%)
Mutual labels:  json-serialization
Easyjson
Fast JSON serializer for golang.
Stars: ✭ 3,512 (+4461.04%)
Mutual labels:  json-serialization
Pyjfuzz
PyJFuzz - Python JSON Fuzzer
Stars: ✭ 342 (+344.16%)
Mutual labels:  json-serialization
Json
JSON for Modern C++
Stars: ✭ 27,824 (+36035.06%)
Mutual labels:  json-serialization
Savegamefree
Save Game Free is a free and simple but powerful solution for saving and loading game data in unity.
Stars: ✭ 279 (+262.34%)
Mutual labels:  json-serialization
Eminim
JSON serialization framework for Nim, works from a Stream directly to any type and back. Depends only on stdlib.
Stars: ✭ 32 (-58.44%)
Mutual labels:  json-serialization
kson
A Java serialization/deserialization library to convert Java Objects into json and back, faster and powerful then Gson.
Stars: ✭ 25 (-67.53%)
Mutual labels:  json-serialization
Element Api
Create a JSON API/Feed for your elements in Craft.
Stars: ✭ 493 (+540.26%)
Mutual labels:  json-serialization
Msgpack Unity3d
MessagePack and JSON serializer for Unity3D
Stars: ✭ 74 (-3.9%)
Mutual labels:  json-serialization
Granola
Simple JSON serializers (Cereal-izers. GET IT?)
Stars: ✭ 39 (-49.35%)
Mutual labels:  json-serialization
Fasteasymapping
A tool for fast serializing & deserializing of JSON
Stars: ✭ 556 (+622.08%)
Mutual labels:  json-serialization

JsonSerializerSwift

A simple Json Serializer for Swift

Update 14-06-2017:

Merged a pull request, now arrays of primitives are no longer enclosed in tuborg clamps {}. Updated tests to reflect this. Might be a breaking change, but it is fixing a bug.

Update 14-09-2016:

Works with Swift 3.0. If you work with Swift 2.0 commit 921763ba36dbf1ce710f615d4c2ef838d2b4af3b will work. But I'm not planning on creating separate branches for Swift V2 and V3, so updates from now on will only be added to Swift 3.0 version.

About

Parse your Swift object instances to a JSON string. This is a simple one-to-one conversion atm. Pretty print is supported. Properties will be named the same as in your classes as in the JSON string.

Uses reflection. On a MBP 15 Ultimo 2013 I'm getting about 1.5 sec for serializing a simple three-layer-inheritance object with 10000 array objects.

To use

Here a simple test case is shown. For more tests see the JsonSerializerSwiftTests file, git clone to run them yourself :)

//Arrange your model classes
class Object {
  var id: Int = 182371823
  }
class Animal: Object {
  var weight: Double = 2.5
  var age: Int = 2
  var name: String? = "An animal"
  }
class Cat: Animal {
  var fur: Bool = true
}

let m = Cat()

//Act
let json = JSONSerializer.toJson(m)

//Assert
let expected = "{\"fur\": true, \"weight\": 2.5, \"age\": 2, \"name\": \"An animal\", \"id\": 182371823}"
stringCompareHelper(json, expected) //returns true

Currently supports standard types, optional standard types, arrays, arrays of nullables standard types, array of custom classes, inheritance, composition of custom objects, structs.

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].