Questions tagged [cjson]

cJSON aims to be the dumbest possible parser that you can get your job done with. It's a single file of C, and a single header file.

cJSON aims to be the dumbest possible parser that you can get your job done with. It's a single file of C, and a single header file.

110 questions
0
votes
1 answer

undefined reference to `cJSON_Parse'

I am using Azure SDK. In the SDK I have included cJSON functionalities, I know I need to link cJSON.h to my code. But in azure makefile, I am finding it difficult. Do help in linking the cJSON header file.
Yogesh
  • 273
  • 1
  • 3
  • 10
0
votes
1 answer

cjson encode - remove the "" from string

I have a JWT that i am decoding and printing to my log, but the problem is when i do that it is also including the "" which i do not want ... Here is the snippet of my code that is doing the work for me local jwt = require "resty.jwt" local jwt_obj…
user9576045
0
votes
1 answer

cJSON Parsing Suggestion

I am trying to Parse the below JSON String in my Microcontroller code using CJSON. { "A": { "A1": [ {"S":0,"V":-5}, {"S":60,"V":5} ], …
user3125451
  • 49
  • 2
  • 6
0
votes
1 answer

Why is this message sent using paho.mqtt.c causing segmentation fault?

I am trying to send a specific message type using the MQTT protocol. I am using the paho.mqtt.c library, and my broker is RabbitMQ 3.6.12, running Erlang 20.0. I am working on a virtual machine running CentOS 6.9. I first tried doing it by creating…
Flxnt
  • 177
  • 4
  • 22
0
votes
1 answer

C string has random trailing characters, null-terminated issue?

I'm using cJSON in combination with the JNI to pass JSON data back and forth between my Java and C components. I'm new to C and teaching myself, so bear with me. cJSON has a nice function, cJSON->Print, which converts a JSON structure into a string…
David Mordigal
  • 813
  • 2
  • 9
  • 22
0
votes
1 answer

cJSON can`t parse more than 4 elements

Trying to use cJSON parser with STM32F103C8T6 and KEIL IDE The problem is that the parser works pretty well with up to 4 elements of the JSON string, when trying to add the fifth element it gives up. This code seems to be OK: #include…
Questdoino
  • 13
  • 1
  • 3
0
votes
0 answers

NGINX cjson lua decode json

I am trying to run the cjson decode example found in the manual : and I can't seem to get it to work. Here is the relevant config: location / { content_by_lua ' local cjson = require("cjson") …
Joel Parker
  • 295
  • 1
  • 4
  • 17
0
votes
2 answers

cJSON c++ - add item object

I'm using cJSON Library. For a body example request with JSON like this: { "user": { "name":"user name", "city":"user city" } } I add the objects like this and its work: cJSON *root; cJSON *user; root =…
Pik93
  • 49
  • 1
  • 2
  • 12
0
votes
1 answer

cJSON - parsing JSON

I'm doing a rest api and i using the cJSON c library in c++. This is my body request example { "userEmail": "email@email.com", "userPassword": "12345678" } In my c++ program i receive this json like this (its work now): cJSON *root; root =…
Pik93
  • 49
  • 1
  • 2
  • 12
0
votes
2 answers

cJSON print function doesn't add number to object

I developing a C embedded software that build a JSON string with several parameters ( string and integer ). For my purpose I used cJSON ) in future I need to parse complex JSON). I build my json with this code: jsonObject = cJSON_CreateObject(); …
Federico
  • 1,117
  • 6
  • 20
  • 37
0
votes
1 answer

How can i parse this json to get the strings and store them in variables?

How can i parse this json response after storing it as a char to get the strings and store them in variables? using any c library. Cjson probably because that's the one i am using to build the request.. { "responseExitCode":"200", …
Danstan
  • 1,501
  • 1
  • 13
  • 20
0
votes
2 answers

C: How to parse a value from Json request?

I am attempting to use the cJSON library, written by Dave Gamble, to read in the following JSON request: {"id":"8358441244995838759","jsonrpc":"2.0","method":"addext", "params":["
Neeraj
  • 13
  • 6
0
votes
1 answer

LUA load JSON configuration from file

I'm trying to move old LUA method which was loading some JSON content from file into global variable into "class". But I get following errors all the time: attempt to call field 'decode' (a nil value) attempt to index global 'cjson' (a nil value) I…
SZMER
  • 183
  • 2
  • 15
0
votes
2 answers

Segmentation Fault when Modifying a cJSON Struct Created by Parsing a String Literal

When using cJSON to parse a string literal I was getting a segmentation fault when free'ing the cJSON structure. The original code was as follows: char* jsonStr = "{ \"command\" : { \"param1\": \"value1\", \"param2\": \"value2\" } }"; cJSON…
Jeremy Whitcher
  • 611
  • 7
  • 10
0
votes
1 answer

How to get rid of extra json keys from MongoDB result

I have just started using MongoDB and RESTHeart api server. I wish to replace my existing DB with MongoDB and existing DB too receives a json from the rest api, I thought the change would be little. So, below is the issue: When I query MongoDB, this…
Jardanian
  • 711
  • 1
  • 6
  • 11