Answers for "json jquery"

9

change js to json

var obj = {name: "Martin", age: 30, country: "United States"};
 
// Converting JS object to JSON string
var json = JSON.stringify(obj);
 
console.log(json);
// Prints: {"name":"Martin","age":30,"country":"United States"} 
"https://www.tutorialrepublic.com/faq/how-to-convert-js-object-to-json-string.php"
Posted by: Guest on May-16-2020
2

jquery ajax json

$.ajax({
  method: "POST",
  url: "some.php",
  dataType: "json",
  data: {}
}).done(json => console.log(json));
Posted by: Guest on March-07-2020
4

convert json.stringify to array in javascript

const myObj = {
  name: 'Skip',
  age: 2,
  favoriteFood: 'Steak'
};

const myObjStr = JSON.stringify(myObj);

console.log(myObjStr);
// "{"name":"Skip","age":2,"favoriteFood":"Steak"}"

console.log(JSON.parse(myObjStr));
// Object {name:"Skip",age:2,favoriteFood:"Steak"}
Posted by: Guest on May-21-2020
0

jquery elements to json

var data = $('div.item').map(function(){
    return {
        classname: 'item',
        content: $(this).text()
    };
}).get();
Posted by: Guest on October-12-2021
0

jq json

echo '{ "foo": "lorem", "bar": "ipsum" }' | jq .
cat input.json | jq .
Posted by: Guest on October-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language