Skip to content

Kriptel/HaxeON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HaxeON

Simplified JSON format

see example

{
	a: 1,
	"b": 1.1
	c: true,
	d: *context.test.a
	array: [1,2,3]
	struct {
		a: 1
		"b": 1.2
	}
	map[]: {
		a: null
		b: 1,
		c: true
		d: **context.test.a
	}
}

Features

  • Context value

    Variable from the context object.

    One asterisk (*) creates an extra layer to preserve the reference during serialization.

    Two asterisks (**) create an "abstract" layer that is not preserved during deserialization.

     var data:String = '
     {
     	a: *context.с
     	b: **context.c
     }';
    
     var obj:Dynamic = {
     	c: 12
     }
     trace(Hxon.parse(data, obj)); // { a: (ContextValue){ value: 12 }, b: 12 }
  • Custom object serialization

     class Value implements ISerializable
     {
     	public var value:String;
    
     	public function new(value:String) {
     		this.value = value;
     	}
    
     	public function serialize():String {
     		return '{a: $value}';
     	}
     }
  • Idents / map keys:

    • "a"
    • 'a'
    • a

About

Simplified JSON format

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages