We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When an optional string is not found, all optional strings behind it are skipped
JSON provided in json_t* A:
{ "azimuth": null, "latitude": "51.36028611", "longitude": "4.27114444", "height": null, "Managable": null, "SIM_ICCID": null, "SIM_MTN": null, "TruckLicensePlate": null, "TruckSerialNumber": null, "monitoring_environment": "Industry", "monitoring_job_override": null, "node_id": null, "sla": "Gold" }
C reproducer:
void test(json_t* A) { const char* str_azi = NULL; const char* str_lat = NULL; const char* str_lon = NULL; const char* str_alt = NULL; //Optionally extract values which are present // All fail (pointers remain empty) json_unpack(A, "{s?s, s?s, s?s, s?s}", \ "azimuth", &str_azi, \ "latitude", &str_lat, \ "longitude", &str_lon, \ "height", &str_alt); // Works (latitude and longitude are both extracted as expected) json_unpack(A, "{s?s, s?s, s?s, s?s}", \ "latitude", &str_lat, \ "longitude", &str_lon, \ "azimuth", &str_azi, \ "height", &str_alt); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When an optional string is not found, all optional strings behind it are skipped
JSON provided in json_t* A:
C reproducer:
The text was updated successfully, but these errors were encountered: