… | |
… | |
20 | |
20 | |
21 | #define INIT_SIZE 32 // initial scalar size to be allocated |
21 | #define INIT_SIZE 32 // initial scalar size to be allocated |
22 | #define INDENT_STEP 3 // spaces per indentation level |
22 | #define INDENT_STEP 3 // spaces per indentation level |
23 | |
23 | |
24 | #define UTF8_MAX_LEN 11 // for perls UTF-X: max. number of octets per character |
24 | #define UTF8_MAX_LEN 11 // for perls UTF-X: max. number of octets per character |
25 | #define SHORT_STRING_LEN 256 // special-case strings of up to this size |
25 | #define SHORT_STRING_LEN 512 // special-case strings of up to this size |
26 | |
26 | |
27 | #define SB do { |
27 | #define SB do { |
28 | #define SE } while (0) |
28 | #define SE } while (0) |
29 | |
29 | |
30 | static HV *json_stash; // JSON::XS:: |
30 | static HV *json_stash; // JSON::XS:: |
… | |
… | |
1037 | XPUSHs (decode_json (jsonstr, *SvJSON (self))); |
1037 | XPUSHs (decode_json (jsonstr, *SvJSON (self))); |
1038 | |
1038 | |
1039 | PROTOTYPES: ENABLE |
1039 | PROTOTYPES: ENABLE |
1040 | |
1040 | |
1041 | void to_json (SV *scalar) |
1041 | void to_json (SV *scalar) |
|
|
1042 | ALIAS: |
|
|
1043 | objToJson = 0 |
1042 | PPCODE: |
1044 | PPCODE: |
1043 | XPUSHs (encode_json (scalar, F_UTF8)); |
1045 | XPUSHs (encode_json (scalar, F_UTF8)); |
1044 | |
1046 | |
1045 | void from_json (SV *jsonstr) |
1047 | void from_json (SV *jsonstr) |
|
|
1048 | ALIAS: |
|
|
1049 | jsonToObj = 0 |
1046 | PPCODE: |
1050 | PPCODE: |
1047 | XPUSHs (decode_json (jsonstr, F_UTF8)); |
1051 | XPUSHs (decode_json (jsonstr, F_UTF8)); |
1048 | |
1052 | |