개발관련(Development)/씨뿔뿔(C++)
[json-c] 배열 json 에서 값 구하기
Clack
2019. 2. 13. 22:26
참조 : json_objec.h File Reference
● json 객체가 배열 json 객체인지 체크
if ( json_object_get_type( test_array_json ) == json_tyoe_array )
● 배열 json 의 길이 구하기
int array_len = json_object_array_length( test_array_json );
● 배열json 에서 0번째 index에 해당하는 object 구하기
json_object *test_array_idx0_json;
test_array_idx0_json = json_object_array_get_idx( test_array_json, 0 );
● 0번째 index 의 object 에서 정수값 구하기
int test_array_idx_value = json_object_get_int( test_array_idx0_json );