Skip to content

jcol2/imjson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Immediate Mode Json Serializer

A quick immediate mode json proof of concept inspired by Tsoding's Jim Library

This uses:

  • YY for integer serialization
  • Zmij for floating point serialization.

This doesn't support formatting, and could use better guardrails (or a better API) around accidentally writing kv pairs into arrays, or accidentally writing array values into objects.

Usage:

#include "imjson.c"
#include <stdio.h>

int
main()
{
 enum { BufLn = 10000 };
 char Buf[BufLn] = {0};
 ij_ctx JsonCtx = IJ_CtxNew(Buf, BufLn);
 ij_ctx *C = &JsonCtx;
 
 IJ_Obj(C, "")
 {
  IJ_Num(C, "test", 123);
  IJ_Arr(C, "heyo")
  {
   IJ_Float(C, "", 3.14);
   IJ_Double(C, "", 3.141592653589);
   IJ_SNum(C, "", -100);
   IJ_Null(C, "");
   IJ_Bool(C, "", true);
  }
 }
 printf(Buf);

 return 0;
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages