Example #1
0
static kbool_t RetrieveJsonArrayAt(KonohaContext *kctx, struct JsonBuf *jsonbuf, size_t index, struct JsonBuf *otherbuf)
{
	if(JSON_TYPE_CHECK(Array, toJSON(jsonbuf->json_i))) {
		otherbuf->json_i = JSONArray_get(toJSON(jsonbuf->json_i), index).bits;
		return otherbuf->json_i == 0;
	}
	return false;
}
Example #2
0
static kbool_t RetrieveJsonArrayAt(KonohaContext *kctx, struct JsonBuf *jsonbuf, size_t index, struct JsonBuf *otherbuf)
{
	JSON json = AsJSON(jsonbuf);
	if(JSON_TYPE_CHECK(Array, json)) {
		JSON ret = JSONArray_get(json, index);
		JSONObject_Retain(ret);
		otherbuf->json_i = ret.bits;
		return true;
	}
	return false;
}
Example #3
0
//## JSON JSONArray.get(int index);
static KMETHOD kJSONArray_get(KonohaContext *kctx, KonohaStack *sfp)
{
	JSON obj = ((kJSON *)sfp[0].asObject)->json;
	JSON json = JSONArray_get(obj, sfp[1].intValue);
	KReturn(NewJsonObject(kctx, sfp, json));
}