1 Star 0 Fork 0

louislivi / json_encode

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

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

<script src="./json_encode.min.js"></script>
<script>
  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));
</script>
  • Result
    {"one":[0,1],"two":{"one":"one","two":"two"},"three":3}

Repository Comments ( 0 )

Sign in for post a comment

About

php json_encode javascript version. expand collapse
JavaScript
Apache-2.0
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
JavaScript
1
https://gitee.com/louislivi/json_encode.git
git@gitee.com:louislivi/json_encode.git
louislivi
json_encode
json_encode
master

Search

181749 a2d7925e 1850385 181749 9f8568a7 1850385