<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to include cJSON library in the project.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92231/how-to-include-cjson-library-in-the-project</link><description>Hi, 
 I am new to the NRF boards and I want to include the cJSON library into my project code. I am going to get some data from another device using in the cJSON format and I want to interpret and process that data. After data processing I need to send</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Sep 2024 05:52:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92231/how-to-include-cjson-library-in-the-project" /><item><title>RE: How to include cJSON library in the project.</title><link>https://devzone.nordicsemi.com/thread/504271?ContentTypeID=1</link><pubDate>Mon, 30 Sep 2024 05:52:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd40a148-7eea-444b-bff5-a96ba4ff2e06</guid><dc:creator>Nordic_Swapnil</dc:creator><description>&lt;p&gt;what about CMakeLists.txt&amp;nbsp;&lt;/p&gt;
&lt;p&gt;buddy you just gave prj.conf and main.c&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to include cJSON library in the project.</title><link>https://devzone.nordicsemi.com/thread/387881?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2022 11:25:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e848020-2033-4df5-ab90-c8aa1fdae38a</guid><dc:creator>Raoul</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;Kconfig options often have other Kconfig options as dependencies. It might be that you haven&amp;#39;t configured the dependencies for CONFIG_CJSON_LIB.&lt;/p&gt;
&lt;p&gt;If you look at the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_CJSON_LIB"&gt;Kconfig reference page&lt;/a&gt; or in the VS Code Kconfig menu, note the following:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1664190787790v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Dependencies:&lt;/strong&gt; (&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_NEWLIB_LIBC"&gt;CONFIG_NEWLIB_LIBC&lt;/a&gt; &amp;amp;&amp;amp; &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_NEWLIB_LIBC_FLOAT_PRINTF"&gt;CONFIG_NEWLIB_LIBC_FLOAT_PRINTF&lt;/a&gt;) || &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_EXTERNAL_LIBC"&gt;CONFIG_EXTERNAL_LIBC&lt;br /&gt;&lt;/a&gt;(Note the &amp;quot;||&amp;quot; (OR) sign, configuring the first two options is enough.)&lt;/p&gt;
&lt;p&gt;When I configure these dependencies in prj.conf of the Hello World sample:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_CJSON_LIB=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I can use the cJSON library:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/zephyr.h&amp;gt;
#include &amp;lt;cJSON.h&amp;gt;

void main(void)
{
	printk(&amp;quot;cJSON version %s\n&amp;quot;, cJSON_Version());
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1664191314201v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Hope this solves your problem.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Raoul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>