- 论坛徽章:
- 0
|
摸索了一下,不知道是否正确,请高手指点:
memcpy(TrCode, tmpbody, 3);
memcpy(BankCode, tmpbody+3, 4);
my_object = json_object_new_object();
json_object_object_add(my_object, "处理码", json_object_new_string(TrCod
e));
json_object_object_add(my_object, "银行代码", json_object_new_string(Ban
kCode));
my_array = json_object_new_array();
for ( i=0; i<4; i++ )
{
my_mx = json_object_new_object();
json_object_object_add(my_mx, "计费数量", json_object_new_int(i)
);
json_object_array_put_idx(my_array, i, my_mx);
}
json_object_object_add(my_object, "票据明细", my_array); |
|