Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

convert form data request to json laravel

$collect = []; // empty array for collect customised inputs

foreach($request->all() as $input_key => $input_value){ // split input one by one

     $collect[] = array( //customised inputs
            "id" => $input_key,
            "value" => $input_value

     );
} 

$result = json_encode($collect); //convert to json
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript event currenttarget 
Javascript :: jest Your test suite must contain at least one test. 
Javascript :: javascript new line 
Javascript :: javascript convert date from mm/dd/yyyy to yyyymmdd 
Javascript :: extract content from string html 
Javascript :: js sleep function with argument 
Javascript :: react grid 
Javascript :: body-parser vs express.json 
Javascript :: array concat in javascript 
Javascript :: js read a ini file 
Javascript :: yup phone number validation 
Javascript :: jquery dropdown selected value show field 
Javascript :: fibonacci series with recursion in javascript 
Javascript :: javascript equivalent of CTRL+F5 
Javascript :: eliminar comillas de un string javascript 
Javascript :: biggest number javascript 
Javascript :: how to destroy a computer using javascript 
Javascript :: react native prevent rotation of screen 
Javascript :: vuejs alerts 
Javascript :: javascript Given a base-10 integer, , convert it to binary (base-10). 
Javascript :: change class of icon using jquery 
Javascript :: local storage react 
Javascript :: Material-ui add circle outline icon 
Javascript :: ** javascript Exponentiation 
Javascript :: how to get keys from request headers in express 
Javascript :: how to auto update package.json 
Javascript :: 1 dollar in rupees 
Javascript :: add next to react 
Javascript :: anagram 
Javascript :: Download excel using reactJS 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =