Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/louislivi/json_encode

php json_encode javascript version.
https://github.com/louislivi/json_encode

encode javascript json jsonparse php

Last synced: 11 days ago
JSON representation

php json_encode javascript version.

Awesome Lists containing this project

README

        

# json_encode
## php json_encode javascript version.

PHP json_encode javascript version.this file has php json_encode function ,and has php json_encode options constents


const JSON_HEX_QUOT = 8;


const JSON_HEX_TAG = 1;


const JSON_HEX_AMP = 2;


const JSON_HEX_APOS = 4;


const JSON_NUMERIC_CHECK = 32;


const JSON_UNESCAPED_SLASHES = 64;


const JSON_UNESCAPED_UNICODE = 256;


const JSON_FORCE_OBJECT = 16;


also chinese to unicode. example

中国 to \u4e2d\u56fd


- Demo

var arr = new Array;
arr['one'] = new Array;
arr['one'][0] = 0;
arr['one'][1] = 1;
arr['two'] = new Array;
arr['two']['one'] = 'one';
arr['two']['two'] = 'two';
arr['three'] = 3;
console.log(json_encode(arr));

* Result

{"one":[0,1],"two":{"one":"one","two":"two"},"three":3}