Replace custom JSON implementation with cJSON library#2034
Draft
Replace custom JSON implementation with cJSON library#2034
Conversation
- Add cJSON as a required dependency in configure script - Replace custom JSON parser in src/misc/json.c with cJSON-based implementation - Replace custom JSON serializer in src/htsmsg_json.c with cJSON-based implementation - The new implementation uses the well-tested cJSON library for both parsing and serialization, reducing the risk of bugs and maintenance burden Co-authored-by: Flole998 <9951871+Flole998@users.noreply.github.com>
Co-authored-by: Flole998 <9951871+Flole998@users.noreply.github.com>
Co-authored-by: Flole998 <9951871+Flole998@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Replace custom JSON creation and parsing with library
Replace custom JSON implementation with cJSON library
Jan 4, 2026
|
Contributor
|
Tested using the Tvheadend UI and the HTTP API. No issues found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The custom JSON parser/serializer is a maintenance burden and potential source of bugs. This replaces it with the well-tested cJSON library.
Changes
libcjsonas a required pkg-config dependencycJSON_Print/cJSON_PrintUnformattedThe existing
json_deserializer_tcallback abstraction is preserved, so no changes needed in calling code.Notes
htsbuf_append_and_escape_jsonstr()retained in htsbuf.c for webui.c usageWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
239.255.255.250REDACTED, pid is -1(packet block)my.pcloud.com/usr/bin/python /usr/bin/python /home/REDACTED/work/tvheadend/tvheadend/support/pcloud.py publink_download kZ54ee7ZUvsSYmb9VGSpnmoVzcAUhpBXLq8k misc/staticlib/Ubuntu 24.04/x86_64/ffmpeg-bb54fc09477ff26635f40d84dd893daf43dd9090.tgz /home/REDACTED/work/tvheadend/tvheadend/build.linux/.ffmpeg-bb54fc09477ff26635f40d84dd893daf43dd9090.tgz.tmp -I adend -I linux-gnu/dbus-1.0/include -I adend/build.linux/src/descrambler/algo/libaesdec--64 -I in.so /lto-wrapper ndor/bin/git -I linux-gnu/dbus-1abcdefghijklmnopqrstuvwxyz -I k/tvheadend/tvheadend/build.linu-o(dns block)/usr/bin/python3 python3 /home/REDACTED/work/tvheadend/tvheadend/support/pcloud.py publink_download kZ54ee7ZUvsSYmb9VGSpnmoVzcAUhpBXLq8k misc/staticlib/Ubuntu 24.04/x86_64/ffmpeg-bb54fc09477ff26635f40d84dd893daf43dd9090.tgz /home/REDACTED/work/tvheadend/tvheadend/build.linux/.ffmpeg-bb54fc09477ff26635f40d84dd893daf43dd9090.tgz.tmp -I adend -I linux-gnu/dbus-1.0/include -I adend/build.linux/src/descramble/tmp/7355.bin -I on -I rgo/bin/as -I linux-gnu/dbus-1.0/include -I k/tvheadend/tvheadend/build.linux(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.