From 612045f53f7e5edf9faa359ee9ee52d490d58000 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 17 Sep 2014 22:56:34 +0100 Subject: py: Add native json printing using existing print framework. Also add start of ujson module with dumps implemented. Enabled in unix and stmhal ports. Test passes on both. --- py/objnone.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'py/objnone.c') diff --git a/py/objnone.c b/py/objnone.c index a8d607143..01536dcb3 100644 --- a/py/objnone.c +++ b/py/objnone.c @@ -38,7 +38,11 @@ typedef struct _mp_obj_none_t { } mp_obj_none_t; STATIC void none_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { - print(env, "None"); + if (MICROPY_PY_UJSON && kind == PRINT_JSON) { + print(env, "null"); + } else { + print(env, "None"); + } } STATIC mp_obj_t none_unary_op(mp_uint_t op, mp_obj_t o_in) { -- cgit v1.2.3