Questions tagged [json-c]

JSON-C is a C library for parsing and generating JSON. It includes a reference counted model for JSON objects.

For more information: JSON-C - A JSON implementation in C

86 questions
0
votes
1 answer

JSON-C build on Windows Platform

Disclaimer: Please read question carefully, This question has a twist so read it till end. So JSON-C is one of the highly popular library to work on JSON using C programming. Basic illustration on current work, whatever code building here is for…
Novice
  • 540
  • 2
  • 8
  • 21
0
votes
0 answers

Shared library symbol conflicts - C

I have an application which is linked to json-c and a third party library. This third party library is linked to libjansson library. So when I execute my application, it crashes due to memory corruption as invalid pointer. On analysis, both the…
Vysakh A V
  • 111
  • 1
  • 11
0
votes
2 answers

Function that returns array of strings in C

I'm new to C and I'm currently working on a project that I need to read a list from a Json file (using json-c library). So, I created a function that returns an array of string (the list). I searched and I found out that to return array of string in…
0
votes
1 answer

Unexpected token 004 at position 0 when posting JSON object in C

Im having a problem when trying to send a JSON object that I created in C. The server is able to both send and receive data just fine. Im quite an amateur when it comes to C. static int main_curl(neardal_record* pRecord) { CURL *curl; …
S_Kalog
  • 3
  • 3
0
votes
1 answer

How to transform several JSON objects using json-c?

I wish to use the json-c library to transform all my objects contained in my .json document: { "name": "mathieu", "password": "def118e47a2f36b73805b01a5fa3f73b506b98166a929802338db6868e28d942", "salt":…
magjico
  • 3
  • 4
0
votes
1 answer

How to split multiple lines of string and store them into a json array in C

I've got a bash script which outputs strings in the format Hostname IP MacAddr and is read by my script in written in C. I am trying to split these 3 up into an array, and make it so that I'm able to store them into a Json-c object to produce…
Tom Bradely
  • 81
  • 1
  • 1
  • 11
0
votes
1 answer

json_tokener_parse giving an unexpected output

Consider the code snippet as shown below const char* jstring; jstring = net->Classify(224, 224, imgCUDA, &confidence); std::cout <
UserA
  • 47
  • 9
0
votes
1 answer

json-c json_object_to_json_string() equivalent api in jansson library

In the Current code i'm using json-c. i'm migrating to jansson. need an equivalent api in jansson which converts the json_object_to_json_string. i found one but it needs a json string object otherwise it is returning null. const char…
Sridhar
  • 1
  • 2
0
votes
1 answer

json-c: segmentation fault when in json_tokener_parse

I am using json-c to parse json files in my project. I tried creating json_tokener_parse but this has resulted in seg-fault. could any please check and tell me the reason for segfault. #include #include #include
0
votes
0 answers

When json_object_put frees memory to system?

I've this code: #include #include #include #include json_object *new_array; void add_result_event(json_object *scan_result) { json_object_array_add(new_array, scan_result); } void…
0
votes
1 answer

Segmentation fault parsing json-c

I am getting a seg fault when I try and get the result of val from my json file the other fetch values return fine if I comment out the lines /*parseText(obj, "val", &tmp); strcpy (test.val, tmp); printf("val = %s\n", test.val); */ This is the…
homeGrown
  • 375
  • 1
  • 8
  • 25
0
votes
1 answer

How to read and write JSON data from a file

I'm using a json-c library in Linux. I have a JSON object : jobj = { "person1": { "Id": 12354, "age": 12, "place": "someplace" }, "person2": { "Id": 123, "age": 122, "place": "someplace" …
code_numb
  • 11
  • 4
0
votes
1 answer

nginx module with json-c undefined symbol: json_object_to_json_string

for install nginx with hello module(this module use #include ) i use yum -y install json-c json-c-devel before install nginx make && make install is successful. but when i run nginx test /usr/sbin/nginx -t error message is show up : nginx: [emerg]…
0
votes
1 answer

Adding Unique Elements to a Json Object using C

Using (learning) c to create a mini packet sniffer which adds the src IPs to a json object and adds them to a json array. The pcap filter works without issue, and now I'm trying to create a json object of the src ips and a counter of packets sent…
simonmorley
  • 2,810
  • 4
  • 30
  • 61
0
votes
1 answer

Json parsing and string management in C

Considering the following functions: int get_timestamp(json_object *json_obj, double *timestamp) { json_object *value_obj; int status; if (json_object_object_get_ex(json_obj, "timestamp", &value_obj)) { if…
vdenotaris
  • 13,297
  • 26
  • 81
  • 132