<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JSON Archives - AtCodex: Empowering Your Financial Journey &amp; Personal Well-Being</title>
	<atom:link href="https://atcodex.com/tag/json/feed/" rel="self" type="application/rss+xml" />
	<link>https://atcodex.com/tag/json/</link>
	<description>Achieve financial success without sacrificing well-being! AtCodex provides actionable strategies for managing money, time, and personal growth—all in one place.</description>
	<lastBuildDate>Sat, 28 Aug 2021 17:15:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://atcodex.com/wp-content/uploads/2020/05/cropped-New-Project-1-32x32.png</url>
	<title>JSON Archives - AtCodex: Empowering Your Financial Journey &amp; Personal Well-Being</title>
	<link>https://atcodex.com/tag/json/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Remove Empty Object From JSON in JavaScript</title>
		<link>https://atcodex.com/how-to/how-to-remove-empty-object-from-json-in-javascript/</link>
		
		<dc:creator><![CDATA[atcodex]]></dc:creator>
		<pubDate>Sat, 08 Aug 2020 07:37:19 +0000</pubDate>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSON]]></category>
		<guid isPermaLink="false">https://atcodex.com/?p=682</guid>

					<description><![CDATA[<p>In this post, we have removed empty objects in JSON using Javascript. It is a very simple code snippet to remove all empty objects in JSON. Output</p>
<p>The post <a href="https://atcodex.com/how-to/how-to-remove-empty-object-from-json-in-javascript/">How to Remove Empty Object From JSON in JavaScript</a> appeared first on <a href="https://atcodex.com">AtCodex: Empowering Your Financial Journey &amp; Personal Well-Being</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">In this post, we have removed empty objects in JSON using Javascript. It is a very simple code snippet to remove all empty objects in JSON. </p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;DOCTYPE html>
&lt;html>
&lt;head>
    &lt;title>How to remove empty object from json in javascript&lt;/title>
&lt;/head>
&lt;body>
   
&lt;script type="text/javascript">
   
    const objectData= { 
      b:'object',
      c: '',
      d: null,
      f: {v: 2, x: '', y: null, m: {a:'xyz'}}
    };
   
    const removeEmptyOrNullObject = (obj) => {
      Object.keys(obj).forEach(k =>
        (obj[k] &amp;&amp; typeof obj[k] === 'object') &amp;&amp; removeEmptyOrNullObject(obj[k]) ||
        (!obj[k] &amp;&amp; obj[k] !== undefined) &amp;&amp; delete obj[k]
      );
      return obj;
    };
   
    finalData = removeEmptyOrNullObject(objectData);
   
    console.log(finalData);
&lt;/script>
&lt;/body>
&lt;/html></pre>



<h2 class="wp-block-heading">Output</h2>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="337" height="322" src="https://atcodex.com/wp-content/uploads/2020/08/Untitled-2.png" alt="How to Remove Empty Object From JSON in JavaScript example" class="wp-image-684" srcset="https://atcodex.com/wp-content/uploads/2020/08/Untitled-2.png 337w, https://atcodex.com/wp-content/uploads/2020/08/Untitled-2-300x287.png 300w" sizes="(max-width: 337px) 100vw, 337px" /></figure>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://atcodex.com/how-to/how-to-remove-empty-object-from-json-in-javascript/">How to Remove Empty Object From JSON in JavaScript</a> appeared first on <a href="https://atcodex.com">AtCodex: Empowering Your Financial Journey &amp; Personal Well-Being</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Handle JSON data using PHP</title>
		<link>https://atcodex.com/php/how-to-handle-json-data-using-php/</link>
		
		<dc:creator><![CDATA[atcodex]]></dc:creator>
		<pubDate>Wed, 15 Jul 2020 17:21:26 +0000</pubDate>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[JSON]]></category>
		<guid isPermaLink="false">https://atcodex.com/?p=393</guid>

					<description><![CDATA[<p>JSON is a primary data format for data interchange. It is very lightweight and easy to read and writes. Nowadays every tool in the web used JSON data format for &#8230; </p>
<p>The post <a href="https://atcodex.com/php/how-to-handle-json-data-using-php/">How to Handle JSON data using PHP</a> appeared first on <a href="https://atcodex.com">AtCodex: Empowering Your Financial Journey &amp; Personal Well-Being</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">JSON is a primary data format for data interchange. It is very lightweight and easy to read and writes. Nowadays every tool in the web used JSON data format for data interchange. It&#8217;s fast, easy to use, readable, and lightweight. In this tutorial, I will let you know <strong>how you can parse the JSON data in PHP</strong>  and <strong>how you can convert PHP array into a JSON</strong> data format. </p>



<h2 class="wp-block-heading">What is JSON?</h2>



<p class="wp-block-paragraph">JSON stands for<strong>&nbsp;JavaScript&nbsp;Object&nbsp;Notation</strong>. JSON is a lightweight data format used for transmitting data from a server to a web page.</p>



<h2 class="wp-block-heading">How to print JSON file data in PHP</h2>



<p class="wp-block-paragraph">sometimes we need to parse JSON file in PHP. In below code snippet you will get to know you how you can print JSON file data in PHP </p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">{
"mango":"very good for health.",
"Banana":" keeps you fit.",
"Avocado":"Helps reduce the risk of stroke."
}</pre>



<p class="wp-block-paragraph">Using PHP we can easily fetch and decode this information :</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">//get JSON data using either file_get_contents or cURL
$result = file_get_contents("http://websiteName.com/path/to/jsonfile/");

//decode JSON string &amp; convert it into a PHP variable. 
$json_data = json_decode($result);

//simply print-out the variable 
echo $json_data->mango;
echo $json_data->Banana;</pre>



<h2 class="wp-block-heading">Converting a PHP array to JSON</h2>



<p class="wp-block-paragraph">you can simply convert PHP array to JSON data, by using<strong> json_encode()</strong>. check the below code.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">$data = array('name'=>'abc','gender'=>'Male');</pre>



<p class="wp-block-paragraph">Usage:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">echo json_encode($data);</pre>



<p class="wp-block-paragraph">Output:</p>



<pre class="wp-block-preformatted">{"name":"abc","gender":"Male"}</pre>



<h2 class="wp-block-heading">How to print JSON data in PHP</h2>



<p class="wp-block-paragraph">You can also convert JSON data in PHP  and print the variable.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">$data = '{"name":"abc","gender":"Male"}';</pre>



<p class="wp-block-paragraph">Usage:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">$output =  json_decode($data);</pre>



<p class="wp-block-paragraph">Output:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">print_r($output);

//simply print-out the variable 
echo $output->name;
echo $output->gender;</pre>
<p>The post <a href="https://atcodex.com/php/how-to-handle-json-data-using-php/">How to Handle JSON data using PHP</a> appeared first on <a href="https://atcodex.com">AtCodex: Empowering Your Financial Journey &amp; Personal Well-Being</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
