Questions tagged [stringify]

A function that converts a JavaScript value to a JavaScript Object Notation (JSON) string.

A common use of JSON is to exchange data to/from a web server. When sending data to a web server, the data has to be a "string". Convert a JavaScript object into a string with JSON.stringify().

JSON.stringify() documentation.

718 questions
-1
votes
2 answers

i just want to print the data in alert but ever time it alert me [object Object] but i want that it will show my table data row

$.post("Hirarchi/addHirarchi", {/*'id':hirarchiId,*/'hirarchiName':hirarchiName,'level':HirarchiLevel}, function(data) { $('#lblMessage').html (data); $('#txtHirarchiName').val(''); …
Salis Tariq
  • 93
  • 1
  • 1
  • 8
-1
votes
4 answers

JSON.stringify adding \n to the array

Why \n is appending to the value after JSON.stringify. Here is the example link http://jsfiddle.net/7nketLmy/ var formData = new Array(); if ($(this).get(0).tagName.toUpperCase() === 'DIV' ){ content = $(this).html(); } …
user2901901
  • 101
  • 1
  • 12
-1
votes
2 answers

How to use JSON Stringify when fields are own object types?

EDIT: Something like this, but this is not working either, but there is the problem I think var stringifyObj = JSON.stringify({ "addressAddressId":$('#address').val(){ "cityId:"$('#city').val(){ …
Sami
  • 2,311
  • 13
  • 46
  • 80
-2
votes
1 answer

appending JS object inside a html element with type of object

hello I wanted to if there is way to add a javaScript object inside a html tag but i want it to be a type of object not string. for more clarification, here is an example : const codeEl = document.querySelector('div') let obj = { "test": 1, …
-2
votes
2 answers

How to pass variable to JSON without printing it as String

How to pass variable to JSON object and print it like JSON object? I simply want to pass variable value in JSON and print it like JSON which can also be used in console.table(obj) With Stringify: var name = "someName"; const json =…
Loizos Vasileiou
  • 674
  • 10
  • 37
-2
votes
1 answer

JSON.parse incorrect string format

i have this string: "{\\'Ovcount\\':\\'0\\',\\'S1\\':\\'LU\\',\\'S2\\':\\'NewClientOrMove\\',\\'memoToDisplay\\':\\'LU -- New Client or Move\\\"}"; and i want it to become like…
Dragos
  • 3
  • 2
-2
votes
1 answer

Parse a stringified JSON containing a stringified array

I've come across something I don't entirely understand and cannot solve however I try. Say I have an object: const jsonExample = { textToReplace: 'My text', arrayToReplace: 'My array: ${arrayParam}', }; And I need to stringify this object…
Mario MG
  • 364
  • 2
  • 13
-2
votes
3 answers

Javascript Strigify Push and Shift given me error

I am new to javascript, please help me with this code, where did I get it wrong? function magix2(arrangment, figures) { arrangment.push(figures); return arrangment.shift(); } var bum = [26,27,28,29,30,31,32]; console.log("Before: " +…
-2
votes
1 answer

Backslash when i stringify my object of object of array of object in Javascript

I work on an app on React-native, and i want to save all the user data on the server with request to an API. But when i tried, my request are buggy. {"body": "{ \"residenceId\": \"5d88dfb55feb4c06a5cfb756\", \"date\":…
MajorKurk
  • 26
  • 1
  • 5
-2
votes
1 answer

JSON.stringify date convert into JSON.parse when return empty value

I have a object convert into json string using JSON.stringify() and then I need same object with using of JSON.parse(), but I get array values are empty, how to I get original data, please help to solve this issue, in below codes is stringify…
-2
votes
3 answers

How get only the name of an object and transform it to string dynamically?

I would transform the name of an object dynamically in string. I would transform the name of the object in string to retrieve it dynamically. output desired: "CartModel" Currently it returns me "[object Object]" Here my object: var…
Webwoman
  • 10,196
  • 12
  • 43
  • 87
-2
votes
1 answer

JSON.parse and JSON.stringify error on special character in string

console.log(JSON.stringify($('.btn').attr('data-obj')))
-2
votes
1 answer

Stringifying an object with nested arrays of objects in Javascript

JSON=new Object();JSON.stringify=function(e){var e=e;var c={}.hasOwnProperty?true:false;var d=function(i){return i<10?"0"+i:i};var a={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function…
bhamlefty24
  • 9
  • 1
  • 4
-2
votes
2 answers

Javascript app: require is not defined

I have an array and I want to create a .json to store the array in it. This is what I have, but i receive require is not defined. I know it has something to do with NodeJS, but I dont know what I should do. let answersString =…
Ezeeroc
  • 185
  • 2
  • 4
  • 14
-2
votes
1 answer

Convert custom javascript object to json

I am trying to convert a custom object in javascript to a json string but i keep getting a circular reference error. Is there a way to use JSON.stringify or do I have to manually create the string myself? Here is my code: function…
Aaron
  • 1,061
  • 3
  • 14
  • 22
1 2 3
47
48