Skip to content

Instantly share code, notes, and snippets.

@gsf
gsf / gist:2576755
Created May 2, 2012 14:05
JSON stringifying and parsing in the Chrome console
> JSON.stringify({aList: '\tthing1\n\tthing2\n'})
"{"aList":"\tthing1\n\tthing2\n"}"
> JSON.parse('{"aList":"\tthing1\n\tthing2\n"}')
▼ SyntaxError: Unexpected token
▶ arguments: Array[1]
▶ get message: function getter() { [native code] }
▶ get stack: function getter() { [native code] }
▶ set message: function setter() { [native code] }
▶ set stack: function setter() { [native code] }
type: "unexpected_token"
@rplantiko
rplantiko / json2data.abap
Created April 2, 2012 11:48 — forked from mydoghasworms/json2data.abap
Added some module tests
REPORT ZZ_TEST_JSON_MYDOG.
*
class lcl_test definition for testing " #AU Risk_Level Harmless
inheriting from cl_aunit_assert. " #AU Duration Short
private section.
methods :
test_string for testing,
test_number for testing,
@mydoghasworms
mydoghasworms / json2data.abap
Created April 2, 2012 09:26
Very trusting JSON to (deep) ABAP data structure mapper
*&---------------------------------------------------------------------*
*& Form json_to_data
*&---------------------------------------------------------------------*
form json_to_data using json type string changing data type any.
data: lv_off type i.
data: lv_len type i.
data: lv_key type string.
data: lv_value type string.
data: lv_char type char1. "Current chacater
data: lv_pchar type char1. "Previous character