724
questions
0
votes
1
answer
27
views
Issues with Emitting Events to Socket.IO Server on Different URLs and JSON Data Conversion
I am working on a Node.js backend project using Socket.IO and am facing two issues when trying to interact with the Socket.IO endpoints via Postman:
1. Connection and Event Emission Issue on Different ...
2
votes
1
answer
73
views
JSON.stringify omits properties from object
I am trying to understand why JSON.stringify shows a different output to the object I am expecting to see.
In my case, my object has a property of height and width
So, if I were to do perform the ...
0
votes
0
answers
75
views
ERROR Error saving data [TRPCClientError: JSON Parse error: Unexpected character: B]
I have an App that im creating that takes the user through a onboarding process for their user details.
I have two screens where it is triggered. One on a screen where the user is checking to see if ...
1
vote
0
answers
19
views
Is there a way to indicate type that covers all types that can be JSON-stringified? [duplicate]
I'm new to TypeScript. I'm writing a function where one of the arguments is caller-defined anything that can be put through JSON.stringify. Is there any way to indicate this type, or is it technically ...
0
votes
1
answer
29
views
JavaScript: JSON.stringify and replacer, Unexpected behavior
Consider the following code
'use strict';
function stringify(value,p) {
function replacer(k,v) {
if (!Array.isArray(v))
return p(k) ? v : undefined;
return v
}
...
0
votes
2
answers
65
views
Save an object array into one text record per array element
I have an application which, from time to time, saves object arrays into text files. All the elements of the object array display identical structure.
As an example, consider the following object ...
0
votes
0
answers
82
views
Getting "422 Unprocessable Entity" error when positing stringified body from node.js to Python FastAPI [duplicate]
I have this request, on my node.js application :
return new Promise((resolve, reject) => {
const options = {
hostname: 'py', <== docker container
port: 8000,
path: '...
0
votes
0
answers
32
views
In Aurelia Slickgrid how to get editor and filter collectionAsync data?
I use aurelia 2 with import and JSON.stringify this import.
With the example #3, I tried to get the collectionAsync in Aurelia 2. The fetch method tell me that data presented to collectionAsync at ...
0
votes
0
answers
33
views
Why my Json stringify slower then JSON.stringify
So I am trying to understand why my code that stringify an object is much slower then JSON.stringify.
I cant think of a reason for this.
could someone share why this is hapning.
here is my test code ...
-1
votes
4
answers
133
views
How to JSON stringify a javascript New Date
I'm getting data from the form's json when the user fills out the calendar
const data= JSON.stringify(orderForm.informationDate));
Currently, I get data from JSON to print PDF in any way:
{"...
0
votes
0
answers
28
views
Sending a JSON string to FastAPI but 422 error due to pydantic model [duplicate]
I try to send this JSON string to my FastAPI API but I always get an 422.
{"data":[{"pickup_session_id":1,"product_id":3,"product_usage_type_id":0,"total&...
0
votes
2
answers
93
views
JSON.stringify replacer not working as expected (keep properties where name starts with)
I want to keep all property names that start with a certain string and remove all others from an object.
Why is the following not working - keep property foo only - and why does the opposite work? (...
0
votes
0
answers
63
views
AsyncStorage returning [SyntaxError: JSON Parse error: Unexpected character: o]
I am getting the above error when using AsyncStorage.
const defaultCity = {
name: "Tbilisi",
id: "22sH7BDcVH7MOYOtvqbD",
};
const [city, setCity] = useState(...
0
votes
0
answers
180
views
Option to preserve empty arrays and objects at "qs.stringify()" funtion of qs package in react
I want to also preserve an empty array but the qs package is deleting the empty array key from the stringified data:
const data = {
key: [],
name: "Lower"
};
const stringifiedData = qs....
0
votes
1
answer
33
views
Typescript - How to extract values from Sanity API Result - JSON
I am trying to get the values from a Sanity Client API call and can't figure out how to get the values from resulting JSON.
Here is the result of the api call:
[
{
slug: { current: "test-...
1
vote
1
answer
202
views
How can I JSON stringify and then parse an object with functions? (JavaScript)
I have an object with both attributes and functions, and I want to be able to stringify them into JSON, then parse them back out again for a save-load system. Keep in mind, the data has circular ...
1
vote
0
answers
116
views
Why double quotes are being escaped in JSON.stringify but not single quotes
I'm creating a json object string that has single quote in the condition which need to be use in sql query. Something like this,'field IN ('ab'c'd')' so instead I tried using double quotes for the ...
0
votes
2
answers
722
views
How to use JSON.stringify replace to await Promise values?
I have a JSON object I want to stringify. Some of the values in this object are Promises.
How can I use the replacer parameter in JSON.stringify() to pass the result of the Promise, instead of the ...
1
vote
1
answer
35
views
Why doesn't JSON.stringify handle my array of arrays?
I read this question How can I copy an array of arrays into clipboard using javascript and want to achieve something similar: first I execute $x(XPath) to get an array of arrays:
I want to stringify ...
0
votes
1
answer
185
views
How to to print nested [object Object] without affecting other types
I am currently trying to show some data on my webpage (not the console, actually inject it into a paragraph) which (for example) looks as follows:
["accept", "#PID<0.395.0>", ...
2
votes
1
answer
86
views
In R, convert list into stringified JSON for body of POST request
output_goal <- '{ "firstName": "Tim", "lastName": "Jones", "team": { "value":104290, "teamMarket": "Card", "...
-2
votes
1
answer
100
views
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....
0
votes
2
answers
48
views
For cycle returning [object Object]
I want to create a simple table to store the responses in. A book can have multiple authors so the authors object is an array. Author has two fields(first_name and last_name)
I know I have to ...
0
votes
0
answers
39
views
JSON.stringify() returns empty nested objects {} but works in console [duplicate]
In a Django/React app I am building, I use an API call to get some ids, which returns an object like this:
{
"0": {
"0": "7y8X0Z04gJCKtfrnSAMywJ",
&...
0
votes
0
answers
64
views
JSON.parse error unexpected token u due to value being double?
I am getting unexpected token u attempting to parse something in nodejs with JSON.parse.
I am quite certain I know the issue, but I have tried everything I can think of with no luck at solving it.
...
1
vote
1
answer
102
views
How can I write a multiline string into a file without adding characters to the string?
I have a JavaScript function where I'm trying to write a PowerShell script to a PowerShell file. This is the function:
const script =
`$Win32Product= Get-WmiObject -Class Win32_Product | Where Name -...
0
votes
1
answer
421
views
Task is to "stringify" a value in Python. If the value is a dict obj which has nested dicts, the function must recursively call itself for the nested
My task is to write a function in Python, which would work similarly as JS's JSON.stringify() method. The func's signature is - stringify(value[, replacer[, spaces_count]]). So if value is a dict with ...
-1
votes
1
answer
66
views
How to convert a two dimensional json object to one dimensional json object in Typescript
How to convert
{
'summary': {
'name': 'test1',
'age': '12',
'gender': 'M'
},
'address': {
'line1': 'Line1 address test',
'line2': 'Line 2 Adress test'
}
}
to
{
'summary....
1
vote
0
answers
65
views
Is there any way to pass a long javascript array to a python script which is using python cgi
I am creating a webpage with submit button.
Once user will click on submit button all checkboxes values selected by user will be stored in java script array and will be passed onto a python script ...
1
vote
1
answer
204
views
JSON.stringify on javascript with WSO2
i'm trying to transform the following JSON in input:
{
"operation": "create",
"id": "$1",
"name": "esempio ...
0
votes
2
answers
2k
views
How do I add spaces between list elements when using JSON.stringify?
I am using Javascript's JSON.stringify() function to convert a list of strings into a comma separated JSON object.
array = ["a", "b", "c"];
console.log(JSON.stringify(array));
// Output: ["a","b","...
0
votes
2
answers
655
views
JSON.stringify not working with nested array of objects
I know this question has been asked but none of the solutions are working for me and I can't figure out what's wrong. I have an object with a nested array of objects I am stringifying but I get a ...
0
votes
2
answers
550
views
How to properly save my input in local storage in JavaScript?
I am tasked with creating a to do list form . The User should be able to input their 'todos' and then be displayed those todos. The user has the option to remove and cross out each todo. When the user ...
0
votes
2
answers
55
views
stringify-object crashed the test
Every time a test is calling the method stringifyObject from the npm modul stringify-object with an object the test crash with follow exception:
TypeError: get_own_enumerable_property_symbols_1....
1
vote
1
answer
1k
views
How to handle json object that was stringified in Python
I have a question about JSON.stringify() and how to parse it. I have a frontend code and a backend in python (Django).
My fetch function looks like this in frontend.
const response = await fetch('...
0
votes
1
answer
119
views
How can I download a single merged JSON file within a loop whilst using Google API and Javascript?
I have a script that is looping through an array of Google Place IDs and returns some of their Place Details. I’m then using JSON.Stringify to output the data in JSON format.
function initMap() {
//=...
0
votes
0
answers
270
views
JSON.stringify() arguments returns objects in a straight line with slashes // in between
JSON.stringify() arguments still returns objects in a straight line with slashes // in between.
I added ```JSON.stringify(stringifiedData, null, 4) to my code to prettify my object. But I am still ...
0
votes
1
answer
345
views
Jmeter 5.5: extract and store ID value from json response body whose json is in string format
enter image description hereI want to extract id value from json body whose partner join value is Yes
Response body sample:
{"data":{"data1":"{"recommendedPrograms":{...
0
votes
1
answer
483
views
Javascript - convert array to stringify format [duplicate]
I have this array:
array = [
{
"name": "name",
"value": "Olá"
},
{
"name": "age",
"...
-1
votes
1
answer
153
views
JSON.stringify and toString() method, as well as string() all result in doubled quotation marks
I simply do a dict assignment operation like this headers[col] = JSON.stringify(value);
when parsing a TSV and it always results in the JSON keys with double quotation marks when I both use JSON....
1
vote
1
answer
61
views
How to use recursion so this function will work with nested arrays and objects
I'm attempting to write a JSON.stringify function. It works well enough for basic arrays and objects but how can I get it to work for nested arrays?
function stringifier (input) {
let output = '...
0
votes
1
answer
270
views
Angular Material Dialog & JSON.stringify
I am unable to show the string provided by JSON.stringify including the spaces for indentation inside a material dialog of my Angular project. It always appears as a raw data string, without any ...
2
votes
1
answer
123
views
stringify null and undefined without stringify
I'm trying to replicate the functionality of JSON.stringify() with several primitive types, so far I have only managed to pass 'number' and 'string' (the easy ones) which in turn make, function and ...
0
votes
1
answer
214
views
Node-Red: JSON integration into Insert-Statement
In Node-Red is there a way to integrate a JSON-Msg, into an INSERT-Statement as a string without the usage of stringify? Because after 2000 Characters, the Message is cut off.
2
votes
1
answer
3k
views
Uncaught TypeError: json.forEach is not a function
let myJSON = { "name": "naam",
"schools" : [
"silver stone" ,
"woodlands stone" ,
"patthar"
],
&...
1
vote
1
answer
136
views
Another - Expecting 'STRING', '}', got 'undefined'
I have a json string created by
let jsonString = "{ \"AjaxBookGenieParams\": " + JSON.stringify(ajaxBookGenieParams) + " }";
I have a problem with a web service call not ...
-2
votes
2
answers
4k
views
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:
...
0
votes
1
answer
291
views
how to iterate json with parentheses
I have an api that is returning a json data but that data is wrapped in curly brackets and I am not able to iterate the response. I tried to convert that into string, sliced the brackets and then ...
1
vote
1
answer
336
views
Replace Symbol Keys in Object With Text
I have the following object like this:
{ where: { [Symbol(or)]: [ [Object], [Object] ] },hooks: true, rejectOnEmpty: false }
I'm calling JSON.stringify on this, and it gets converted to:
{"where&...
1
vote
0
answers
572
views
How to stringify socket-Object in node.js
I am developing an application, for which I need to send the socket objects themselves.
With socket object I mean the following: if I got an event, lets say
s.on('message'..., the socket object is s. ...