… | |
… | |
2071 | SvREFCNT_dec (self->incr_text); |
2071 | SvREFCNT_dec (self->incr_text); |
2072 | |
2072 | |
2073 | PROTOTYPES: ENABLE |
2073 | PROTOTYPES: ENABLE |
2074 | |
2074 | |
2075 | void encode_json (SV *scalar) |
2075 | void encode_json (SV *scalar) |
2076 | ALIAS: |
|
|
2077 | to_json_ = 0 |
|
|
2078 | encode_json = F_UTF8 |
|
|
2079 | PPCODE: |
2076 | PPCODE: |
2080 | { |
2077 | { |
2081 | JSON json; |
2078 | JSON json; |
2082 | json_init (&json); |
2079 | json_init (&json); |
2083 | json.flags |= ix; |
2080 | json.flags |= F_UTF8; |
2084 | PUTBACK; scalar = encode_json (scalar, &json); SPAGAIN; |
2081 | PUTBACK; scalar = encode_json (scalar, &json); SPAGAIN; |
2085 | XPUSHs (scalar); |
2082 | XPUSHs (scalar); |
2086 | } |
2083 | } |
2087 | |
2084 | |
2088 | void decode_json (SV *jsonstr) |
2085 | void decode_json (SV *jsonstr) |
2089 | ALIAS: |
|
|
2090 | from_json_ = 0 |
|
|
2091 | decode_json = F_UTF8 |
|
|
2092 | PPCODE: |
2086 | PPCODE: |
2093 | { |
2087 | { |
2094 | JSON json; |
2088 | JSON json; |
2095 | json_init (&json); |
2089 | json_init (&json); |
2096 | json.flags |= ix; |
2090 | json.flags |= F_UTF8; |
2097 | PUTBACK; jsonstr = decode_json (jsonstr, &json, 0); SPAGAIN; |
2091 | PUTBACK; jsonstr = decode_json (jsonstr, &json, 0); SPAGAIN; |
2098 | XPUSHs (jsonstr); |
2092 | XPUSHs (jsonstr); |
2099 | } |
2093 | } |
2100 | |
2094 | |