mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
4ed6061733
not raise when cjson parse faild
17 lines
486 B
C
17 lines
486 B
C
#include "pika_cjson.h"
|
|
#include "cJSON.h"
|
|
#include "pika_cjson_cJSON.h"
|
|
|
|
PikaObj* pika_cjson_Parse(PikaObj* self, char* value) {
|
|
cJSON* item = cJSON_Parse(value);
|
|
if (NULL == item) {
|
|
// obj_setErrorCode(self, 3);
|
|
__platform_printf("Error: cJSON parse failed.\r\n");
|
|
return NULL;
|
|
}
|
|
PikaObj* cjson_obj = newNormalObj(New_pika_cjson_cJSON);
|
|
obj_setPtr(cjson_obj, "item", item);
|
|
obj_setInt(cjson_obj, "needfree", 1);
|
|
return cjson_obj;
|
|
}
|