Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON Serialization in C

Tags:

json

c

utf-8

What is the best way to generate UTF-8 JSON in C? I've looked at Jansson, but it seems extremely bulky. Is there any other good low-dependency library for creating and reading JSON objects/strings in C?

like image 932
Peter Downs Avatar asked Jul 05 '11 14:07

Peter Downs


People also ask

What is serialization in JSON?

JSON is a format that encodes objects in a string. Serialization means to convert an object into that string, and deserialization is its inverse operation (convert string -> object).

Can I use JSON in C?

Parsing JSON in C using microjson Developed originally for server-browser communication, the use of JSON has since expanded into a universal data interchange format. This tutorial will provide a simple introduction to parsing JSON strings in the C programming language using the microjson library.

Why do we need JSON serialization?

The purpose of serializing it into JSON is so that the message will be a format that can be understood and from there, deserialize it into an object type that makes sense for the consumer.

Does JSON serialize data?

JSON is a format that encodes an object to a string. On the transmission of data or storing is a file, data need to be in byte strings, but as complex objects are in JSON format. Serialization converts these objects into byte strings which is JSON serialization.


1 Answers

Perhaps the JSON module from CCAN? http://ccodearchive.net/ It doesn't even depend on anything else from CCAN, and consists of exactly two files json.c and json.h

(The JSON module is here http://git.ozlabs.org/?p=ccan;a=tree;f=ccan/json )

like image 70
Spudd86 Avatar answered Sep 21 '22 22:09

Spudd86