<?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 value Archives - Codeplaners</title>
	<atom:link href="https://codeplaners.com/tag/json-value/feed/" rel="self" type="application/rss+xml" />
	<link>https://codeplaners.com/tag/json-value/</link>
	<description>Code Solution</description>
	<lastBuildDate>Thu, 29 Jul 2021 13:44:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>

<image>
	<url>https://codeplaners.com/wp-content/uploads/2020/09/cropped-favicon-social-32x32.png</url>
	<title>Json value Archives - Codeplaners</title>
	<link>https://codeplaners.com/tag/json-value/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How To Use Json In PHP Example</title>
		<link>https://codeplaners.com/how-to-use-json-in-php-example/</link>
					<comments>https://codeplaners.com/how-to-use-json-in-php-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 29 Jul 2021 13:44:21 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Json value]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Source Code]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1123</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you how to use json in PHP example. This article will give you simple example of how to use json in PHP example. you will learn how to use json in PHP example. php has some built-in functions to handle json to given two function in php. -json_encode() &#8230; <a href="https://codeplaners.com/how-to-use-json-in-php-example/" class="more-link">Continue reading<span class="screen-reader-text"> "How To Use Json In PHP Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-use-json-in-php-example/">How To Use Json In PHP Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, i we will show you how to use json in PHP example. This article will give you simple example of how to use json in PHP example. you will learn how to use json in PHP example. </p>
<p>php has some built-in functions to handle json to given two function in php.</p>
<p>-json_encode()</p>
<p>-json_decode()</p>
<p>So let’s follow few step to create example of how to use json in PHP example.</p>
<h3>json_encode()</h3>
<pre class="brush: php; title: ; notranslate">
&lt;!doctype html&gt;
&lt;html&gt;
    &lt;body&gt;
    &lt;?php
        $age = array(&quot;php&quot;=&gt;35, &quot;laravel&quot;=&gt;37, &quot;html&quot;=&gt;43);
        echo json_encode($age);
    ?&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre>
<h3>Output:</h3>
<pre class="brush: php; title: ; notranslate">
{&quot;php&quot;:35,&quot;laravel&quot;:37,&quot;html&quot;:43}
</pre>
<h3>json_decode()</h3>
<pre class="brush: php; title: ; notranslate">
&lt;!doctype html&gt;
&lt;html&gt;
    &lt;body&gt;
    &lt;?php
        $jsonobj = '{&quot;php&quot;:35,&quot;laravel&quot;:37,&quot;html&quot;:43}';
        print_r(json_decode($jsonobj));
    ?&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre>
<h3>Output:</h3>
<pre class="brush: php; title: ; notranslate">
stdclass object ( &#x5B;php] =&gt; 35 &#x5B;laravel] =&gt; 37 &#x5B;html] =&gt; 43 )
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-use-json-in-php-example/">How To Use Json In PHP Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/how-to-use-json-in-php-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Laravel 8  Json Value Send And Get  Example</title>
		<link>https://codeplaners.com/laravel-8-json-value-send-and-get-example/</link>
					<comments>https://codeplaners.com/laravel-8-json-value-send-and-get-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 27 Jul 2021 01:05:51 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Laravel 8]]></category>
		<category><![CDATA[Json value]]></category>
		<category><![CDATA[Source Code]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1103</guid>

					<description><![CDATA[<p>Hi, Today, i we will show you laravel 8 Json value send and get Example. This article will give you simple example of laravel 8 Json value send and get Example. you will learn laravel 8 Json value send and get Example. So let’s follow few step to create example of laravel 8 Json value &#8230; <a href="https://codeplaners.com/laravel-8-json-value-send-and-get-example/" class="more-link">Continue reading<span class="screen-reader-text"> "Laravel 8  Json Value Send And Get  Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/laravel-8-json-value-send-and-get-example/">Laravel 8  Json Value Send And Get  Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi,</p>
<p>Today, i we will show you laravel 8 Json value send and get Example. This article will give you simple example of laravel 8 Json value send and get Example. you will learn laravel 8 Json value send and get Example. So let’s follow few step to create example of laravel 8 Json value send and get Example.</p>
<p><img decoding="async" style="border: 3px solid #ff5722;" alt="Laravel 8  Json Value Send And Get  Example" src="https://codeplaners.com/wp-content/uploads/2021/07/json.png"></p>
<p><img decoding="async" style="border: 3px solid #ff5722;" alt="Laravel 8  Json Value Send And Get  Example" src="https://codeplaners.com/wp-content/uploads/2021/07/jsontable.png"></p>
<h3>Step 1: Install Laravel</h3>
<pre class="brush: php; title: ; notranslate">
composer create-project --prefer-dist laravel/laravel blog
</pre>
<h3>Step 2: Database Configuration</h3>
<pre class="brush: php; title: ; notranslate">
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database name
DB_USERNAME=database username
DB_PASSWORD=database password
</pre>
<h3>Step 3: Create Table and Model</h3>
<pre class="brush: plain; title: ; notranslate">
php artisan make:model Product -m
</pre>
<p><strong>app/Product.php</strong></p>
<pre class="brush: plain; title: ; notranslate">
&lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    use HasFactory;
	
	protected $fillable = &#x5B;
        'properties'
    ];
	
	protected $casts = &#x5B;
        'properties' =&gt; 'array'
    ];
	
	public function setPropertiesAttribute($value)
	{
	    $properties = &#x5B;];

	    foreach ($value as $array_item) {
	        if (!is_null($array_item&#x5B;'title'])) {
	            $properties&#x5B;] = $array_item;
	        }
	    }

	    $this-&gt;attributes&#x5B;'properties'] = json_encode($properties);
	}

}

</pre>
<p><strong>database/migration/create_products_table.php</strong></p>
<pre class="brush: plain; title: ; notranslate">
public function up()
    {
        Schema::create('products', function (Blueprint $table) {
            $table-&gt;increments('id');
            $table-&gt;json('properties');
            $table-&gt;timestamps();
        });
    }
</pre>
<pre class="brush: php; title: ; notranslate">
php artisan migrate
</pre>
<h3>Step 4: Create Route</h3>
<pre class="brush: php; title: ; notranslate">
use App\Http\Controllers\ProductController;

Route::get('input-fields', &#x5B;ProductController::class, 'index']);
Route::post('input-fields', &#x5B;ProductController::class, 'store']);
</pre>
<h3>Step 5: Create Controller</h3>
<p><strong>App\Http\Controllers\ContactController</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
  
namespace App\Http\Controllers;
  
use Illuminate\Http\Request;
use App\Models\Product;

use Illuminate\Support\Facades\Validator;
  
class DynamicAddRemoveFieldController  extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index() 
    {
	$todos = Product::get();
		
     return view(&quot;product&quot;, compact('todos'));
    }
    public function store(Request $request)
    {

    $product = Product::create($request-&gt;all());
		
		
        return back()-&gt;with('success', 'Created Successfully.');
    }
}
</pre>
<h3>Step 6: Create Blade</h3>
<pre class="brush: php; title: ; notranslate">
&lt;!DOCTYPE html&gt;
	&lt;html&gt;
		&lt;head&gt;
            &lt;title&gt;Laravel 8  Json Value Send And Get  Example&lt;/title&gt;
            &lt;link rel=&quot;stylesheet&quot; href=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.5.1/css/bootstrap.min.css&quot;&gt;
            &lt;script src=&quot;https://code.jquery.com/jquery-3.5.1.min.js&quot;&gt;&lt;/script&gt;
            &lt;script src=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.5.1/js/bootstrap.min.js&quot;&gt;&lt;/script&gt;
            &lt;meta name=&quot;csrf-token&quot; content=&quot;{{ csrf_token() }}&quot;&gt;
        &lt;/head&gt;
&lt;body&gt;
        &lt;div class=&quot;container&quot;&gt;
        	&lt;div class=&quot;card mt-3&quot;&gt;
        		&lt;div class=&quot;card-header&quot;&gt;&lt;h2&gt;Laravel 8  Json Value Send And Get  Example&lt;/h2&gt;&lt;/div&gt;
        			&lt;div class=&quot;card-body&quot;&gt;
        				&lt;form action=&quot;{{ url('input-fields') }}&quot; method=&quot;POST&quot;&gt;
                            @csrf
                            	@if ($errors-&gt;any())
                            		&lt;div class=&quot;alert alert-danger&quot;&gt;
                                        &lt;ul&gt;
                                            @foreach ($errors-&gt;all() as $error)
                                            	&lt;li&gt;{{ $error }}&lt;/li&gt;
                                            @endforeach
                                        &lt;/ul&gt;
                            		&lt;/div&gt;
                            	@endif
                                @if (Session::has('success'))
                                    &lt;div class=&quot;alert alert-success text-center&quot;&gt;
                                        &lt;a href=&quot;#&quot; class=&quot;close&quot; data-dismiss=&quot;alert&quot; aria-label=&quot;close&quot;&gt;×&lt;/a&gt;
                                        &lt;p&gt;{{ Session::get('success') }}&lt;/p&gt;
                                    &lt;/div&gt;
                                @endif
                                &lt;table class=&quot;table table-bordered&quot; id=&quot;dynamicAddRemove&quot;&gt;  
                                    &lt;tr&gt;
                                        &lt;th&gt;Title&lt;/th&gt;
                                        &lt;th&gt;Description&lt;/th&gt;
                                        &lt;th&gt;Action&lt;/th&gt;
                                    &lt;/tr&gt;
                                    &lt;tr&gt;  
                                        &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;properties&#x5B;0]&#x5B;title]&quot; placeholder=&quot;Enter title&quot; class=&quot;form-control&quot; /&gt;&lt;/td&gt;  
                                        &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;properties&#x5B;0]&#x5B;description]&quot; placeholder=&quot;Enter description&quot; class=&quot;form-control&quot; /&gt;&lt;/td&gt;  
                                        &lt;td&gt;&lt;button type=&quot;button&quot; name=&quot;add&quot; id=&quot;add-btn&quot; class=&quot;btn btn-success&quot;&gt;Add More&lt;/button&gt;&lt;/td&gt;  
                                    &lt;/tr&gt;  
                                &lt;/table&gt; 
        						&lt;button type=&quot;submit&quot; class=&quot;btn btn-success&quot;&gt;Save&lt;/button&gt;
        				&lt;/form&gt;
        			&lt;/div&gt;
        		&lt;/div&gt;
                
                &lt;h2&gt;Json Table Get&lt;/h2&gt;
                &lt;?php $orders = json_decode($todos, true);?&gt;
                @foreach($orders as $order)
                    &lt;table class=&quot;table table-bordered&quot; id=&quot;dynamicAddRemove&quot;&gt;  
                    &lt;tr&gt;
                        &lt;th&gt;Title&lt;/th&gt;
                        &lt;th&gt;Description&lt;/th&gt;
                    &lt;/tr&gt;
                    @foreach($order&#x5B;'properties'] as $item)
                       &lt;tr&gt;
                         &lt;td&gt;{{ $item&#x5B;'title'] }}&lt;/td&gt;
                         &lt;td&gt;{{ $item&#x5B;'description'] }}&lt;/td&gt;
                       &lt;/tr&gt;
                    @endforeach
                  &lt;/table&gt;
                @endforeach
                
        	&lt;/div&gt;



	 
&lt;script type=&quot;text/javascript&quot;&gt;
var i = 0;
$(&quot;#add-btn&quot;).click(function(){
++i;
$(&quot;#dynamicAddRemove&quot;).append('&lt;tr&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;properties&#x5B;'+i+']&#x5B;title]&quot; placeholder=&quot;Enter title&quot; class=&quot;form-control&quot; /&gt;&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;properties&#x5B;'+i+']&#x5B;description]&quot; placeholder=&quot;Enter description&quot; class=&quot;form-control&quot; /&gt;&lt;/td&gt;&lt;td&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-danger remove-tr&quot;&gt;Remove&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;');
});
$(document).on('click', '.remove-tr', function(){  
$(this).parents('tr').remove();
});  
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h3>Step 7: Run Server</h3>
<pre class="brush: php; title: ; notranslate">
php artisan serve
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/laravel-8-json-value-send-and-get-example/">Laravel 8  Json Value Send And Get  Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/laravel-8-json-value-send-and-get-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
