Questions tagged [json]

JSON (JavaScript Object Notation) serves as a versatile data exchange format that can be easily understood by both machines and humans. Please refrain from employing this label when referring to native JavaScript objects or JavaScript object literals. Prior to seeking assistance, ensure the validity of your JSON through an esteemed validator like JSONLint (https://jsonlint.com).

Transform basic text into nested JSON structure with JavaScript

There is a plain string in my possession which contains various conditions. const optionString = '{2109} AND ({2370} OR {1701} OR {2702}) AND {1234} AND ({2245} OR {2339})'; The goal is to transform this string into an object structured as foll ...

Creating an object with an array of objects as a field in MongoDB: A step-by-step guide

I have a unique schema here: const UniqueExerciseSchema = new Schema({ exerciseTitle: { type: String }, logSet: [{ weight: { type: Number }, sets: { type: Number }, reps: { type: Number }, }], }); After obtaining the da ...

Obtaining the responseJSON property from a jQuery $.ajax object involves accessing the data returned

Recently, I encountered an issue with my JavaScript code that involves an AJAX request: $ajax = $.ajax({ type: 'GET', url: 'DBConnect.php', data: '', dataType: 'json', success: function(data) {} ...

Guide to importing a JSON file in a Node.js JavaScript file

I am trying to incorporate a JSON file into my JavaScript code in a Node.js application. I attempted to include it using the "require();" method, but encountered an issue: "Uncaught ReferenceError: require is not defined". ...

Convert a multidimensional array into a string using JavaScript

Currently, I'm in the process of generating an invoice for a collection of books and my intent is to submit it using ajax. However, when attempting to json encode the array of books within the invoice, I am encountering a setback where the value keeps ...

Risks associated with storing configuration files in JSON/CPickle are related to security

In search of a secure and flexible solution for storing credentials in a config file for database connections and other private information within a Python module. This module is responsible for logging user activity in the system through different handler ...

Are all properties in PHP's mysql_fetch_object function converted to strings?

Looking for assistance! I'm facing an issue where mysql_fetch_object is returning all properties as type string. I need to convert the object to JSON while preserving numerical and Boolean values. The parsing of resulting JSON is taking a long time for a ...

Gson parser failing to parse JSON data

Below is a JSON string that I am working with: [{"BranchID":1,"SecurityCode1":13,"SecurityCode2":14,"PrintHeight":10,"PrintWidth":10,"Active":true}] This is the code snippet I am using to parse the JSON data: Type t = new TypeToken<List<Setting&g ...

Extract data from a JSON file and refine an array

Currently, I am working with reactjs and have an array stored in a json file. My current task involves filtering this array using the selectYear function. However, when attempting to filter the data using date.filter, I encounter the following error: An ...

Utilizing Symfony REST DTO validation and injecting it into the Model similar to a paramconverter

Is there a way to create a request filter for post actions in a JSON REST API that takes the request's body, fills the DTO, validates it, and injects it into the controller action like paramconverter? I have an ExampleDTO structured like this: class ...

My webpage is experiencing issues with function calls not functioning as expected

I have created a select menu that is integrated with the Google Font API. To demonstrate how it works, I have set up a working version on JSBIN which you can view here. However, when I tried to replicate the code in an HTML page, I encountered some issues ...

Retrieve information from JsonResult

While working with ASP.NET Core, the MVC controller is returning JSON data. I am currently attempting to retrieve this data in a unit test. The best solution so far has been string data = JsonConvert.SerializeObject(jsonResult.Value); and then comparing ...

Copy both the image and JSON object to the clipboard

I am attempting to utilize the clipboard API to write an image and JSON object to the window clipboard. I am working with Vue and Electron and have successfully written an image and plain text, but I encounter an error when trying to write a JSON object: ...

Using JQ for parsing deeply nested arrays

Having trouble extracting data from a JSON file: { "operations": [ { "operationName": "GetValue", "batch_size": "2", "orders": [ { "clientId": "7836", "validation_time": { "place": "136", ...

What is the best way to transfer my saved bookmarks and import them into a database?

Over the years, I've amassed a large collection of bookmarks that I now want to organize in a searchable table with additional details like categories, types, and descriptions. My initial approach involved manually inputting them into a JSON file and ...

Obtain POST information through AJAX and jQuery

post.js $.post( "/scripts/update.php", {id: testId, age: testAge}, function(data) { $(".testDiv").html(data.testId); $(".testDiv2").html(data.testAge); } ); update.php $userId = $_POST["id"]; $userAge = $_POST["age]; // contact database ...

An issue arises when using JSON.parse() with regular expression values

I am encountering an issue with parsing a JSON string encoded with PHP 5.2 json_encode(). Here is the JSON string: {"foo":"\\."} Although this JSON string is valid according to jsonlint.com, when using the native JSON.parse() method in Chrome a ...

Tips for gathering all links from a JSON object

When dealing with a JSON object of any structure, simple or complex, what would be the most efficient way to extract all URLs from the data and store them in an array for iteration in JavaScript? { "url": "https://example.com:443/-/m ...

Utilizing Jquery for JSON Data Parsing

I have some JSON data that looks like this: {"product":["{productTitle=ABCD , productImage=/abcd.jpg, productPath=CDEF.html, productPrice=$299}","{productTitle=EFGH, productImage=xxxx.jpg, productPath=ggfft.html, productPrice=$299}"]} In my JSP page, I&a ...

Retrieving JSON objects from a MySQL database

Is there a way to store a JSON string in a database and select entries based on the values of the JSON object using MySQL? I am working with PHP and MySQL 5.1. ...

RecyclerVroom: There seems to be a problem with the Police Data JSON - The adapter is

Hi everyone, I need some assistance with retrieving data from the police data website. Unfortunately, when I try to fetch the data, the application displays an error message "E/RecyclerView: No adapter attached; skipping layout". I have shared the code f ...

Issues encountered when attempting to append the array objects to HTML using $.getjson

Hello, I have a JSON data structure as shown below: [{ "menu": "File", }, { "menu": "File1", }] I have created jQuery code to dynamically add the response to my HTML page like this: $(document).ready(function () { $.getJSON('data.json', func ...

How can I process a data retrieval request in a Laravel controller if someone asks for information from my applications?

The request will be in JSON format, as follows: { "app_id": 1234, "app_key": "our_app_key", "bus_id": 67, "data": [{ "seat_id": 1 }, { "seat_id": 2 }] This is the content of my routes.php file: Route::get('getBookingSeats', 'Selec ...

Transforming JArray into an Object with specific attributes

I am faced with the challenge of converting a JArray into an Object using Attributes because I cannot modify the existing call in a decoupled class: var message = JsonConvert.DeserializeObject(e.Message, messageType) The JSON data to be converted is as f ...

Interacting with JSON API data in real-time using AJAX and the power of JQuery

I'm currently working on displaying data dynamically from an API, and everything is functioning well except for the "Next" and "Previous" links. I can't seem to get them to update the value count in the search bar. My problem lies in executing my initial o ...

Updating embedded documents with new information in mongodb

After searching on SO, I couldn't find a satisfactory answer to my question related to working with mongodb and php for the past couple of weeks. So here I am seeking help. I have a database where I need to add new data to one of the embedded/nested docume ...

My Ajax request in Javascript is encountering failure in Chrome due to AdBlock. What alternatives can I consider in this situation

Attempting to execute an ajax function $.ajax({ url: etsyURL, dataType: 'jsonp', success: function(data) { However, when running it on Chrome in a live environment, it fails due to adblock. I rely on javascript/jquery as my primary tools. Any ...

Trouble with jQuery UI autocomplete showing categories

Can anyone figure out why the Category is showing up as undefined? I'm able to retrieve the items but not the category. $.widget( "custom.catcomplete", $.ui.autocomplete, { _renderMenu: function( ul, items ) { var that = this, ...

Guide to forming an array by extracting specific properties from a nested JSON array using javascript

Currently, I have this list: list = { id: 1, arr: [ {index : 1 , description: "lol" , author: "Arthur"}, {index : 2 , description: "sdadsa" , author: "Bob"}, {index : 3 , desc ...

Obtain product pricing information from a JSON file

Trying to fetch product details from an adidas API using the code snippet below: import requests url = "https://www.adidas.com/api/plp/content-engine?" params = { 'sitePath': 'us', 'query': 'women-athl ...

The occurrence of Simplejson decoding error arises solely during the execution of more than two iterations

I'm using the names module in conjunction with a wrapper for temp-mail.org (https://github.com/saippuakauppias/temp-mail) as part of my project that involves generating temporary email addresses. The code I have provided below is functioning properly unles ...

Decoding JSON using abbreviated keys in C#

I am in the process of transferring a project from Android to Windows Phone 8 and am struggling to find information on how to specify which JSON key corresponds to each object field. In my Android code, I utilized Google GSON and the SerializedName annota ...

Error message "Unexpected token" occurs when attempting to use JSON.parse on an array generated in PHP

My attempt to AJAX a JSON array is hitting a snag - when I utilize JSON.parse, an error pops up: Uncaught SyntaxError: Unexpected token Take a look at my PHP snippet: $infoJson = array('info' => array()); while($row = mysqli_fetch_array($que ...

"Transforming a query into a JSON array - a step-by-step

My query generates the following output: { key:1,label:"R. Bulan"} { key:2,label:"R. Bintang"} { key:3,label:"R. Akasia"} { key:4,label:"R. Guest Room"} This is my SQL query: select '{ '||'key:'||IDMEETINGROOM||''||',label:"'||NAMARUANG||'"'||'} ' json ...

PHP enables real-time control of a pop-up message box

I am currently working on a real-time project and looking for a way to send live announcements or pop-up alerts that can be controlled by admins to all users on the webpage. Although I found a solution called Realtime announcer online, our company policy ...

Using Swift to convert JSON data into a table view

I'm currently faced with the challenge of parsing JSON data into my table view in Swift for iOS development. As a newcomer to this field, some aspects are still unfamiliar to me and I could use some guidance. After following a helpful guide on setting up ...

Tips for extracting values from an array that was fetched using cURL and stored as JSON with .JQ

{ "accounts": [ { "accountId": "account001", "tokens": [ "tokens1", "tokens2", "tokens3", "tokens4", ] } ] } the ...

What is the proper way to execute this API request and retrieve the latest news data using the Fetch method?

Note: Please note that the API Key used in this code is not a real one for privacy reasons. const url = 'http://newsapi.org/v2/everything?' + 'q=platformer&' + 'apiKey=3ce15c4d1fd3485cbcf17879bab498db'; async function getNews() { ...

Using a jQuery calendar to generate a JSON date range

In my current situation, I am faced with a task where I need to choose a date from a jQuery Calendar and then, using ajax, cycle through a JSON file. The problem I encounter stems from dealing with date ranges, such as startdate and enddate: { "campu ...

The process of generating a ticket on osticket using the REST API

I'm in the process of utilizing osticket's REST API to generate a ticket (https://github.com/osTicket/osTicket-1.7/blob/develop/setup/doc/api/tickets.md) The issue arises when I attempt to access /api/tickets.json and receive a 404 error. Even t ...

Managing Custom Boolean strings using Jackson Streaming API

Utilizing the Streaming API provided by Jackson for parsing JSON strings, I have a requirement to recognize "YES" as a boolean type. JsonFactory f = new JsonFactory(); Following that, I proceed with: JsonParser jp = f.createJsonParser(jsonString); Then ...

Is there a specific JSON schema designed for the SurveyMonkey API?

Currently, I am using the SurveyMonkey API to write Java code for survey analysis. The API provides JSON data which I need to manipulate efficiently and safely in my code by generating specific Java classes. However, despite my efforts, I have been unable ...

The connection to the Docker Container on localhost is not established

I am currently working on setting up a React app that communicates with a json server within a docker container. Below is the Dockerfile configuration I am using: # base image FROM node:alpine # set working directory WORKDIR '/app' # add `/app ...

Struggling to properly render JSON data

Having trouble accessing specific elements in a script that merges local JSON files using AJAX? The script works fine in Chrome Console, but you can't reach certain elements like 'object.country'. Any suggestions on how to tackle this issue? ...

Using R programming language to download PDF files from a website through web scraping

Looking for assistance in R coding to automatically download all the PDFs linked on this URL: . The goal is to save these PDFs into a designated folder. I've attempted the following script with guidance from , however, it's resulting in errors: library(tid ...

receiving no response from the PHP server

Hello everyone, I'm currently working on integrating PHP web services into my Android application. Below is a snippet of my Android code: userName = userNameField.getText().toString(); passWord = passWordField.getText().toString(); try { JSONObject json ...

Enhance User Experience by Dynamically Updating Google Maps Markers with Custom Icons Using Django and JSON

Hey StackOverflow Community! I've been working on creating a web interface to showcase the communication statuses of different network elements. I'm almost done with the challenging part that I had been procrastinating. To add an awesome touch, I decided ...

The number input is not compatible with JavaScript/jQuery validation

While working on input field validation using javascript/jQuery code, I encountered an issue where the code worked fine with input type text but did not support input type number. Specifically, the 'number' type input did not work at all in FireFox. My cl ...

Something is seriously wrong with the datetime in fullcalendar JavaScript

I've been diving into a tutorial for creating a calendar scheduler in asp.net MVC5 from this link. One issue I'm facing is the datetime being passed and stored as the min value in the database (1/1/0001 12:00:00 AM), almost like it's null because it's emp ...

Utilizing UI-GRID to showcase JSON information

I am currently in the process of fetching data from the server. [ { id:1, name:demo, request: { id: 1, localCompany: { id: 1 } } }] [{ }, { }] This is how my JSON object appears to be structured. After calling ...

No data in Django json request.body

I'm currently working with an API that requires sending a callback to a specific URL. I have configured my URL and view as follows: def get_callback(request): ... some processing with request.body Despite setting up the view, when I check the req ...

Adding JSON arrays into a MySQL table with Python

I am currently facing issues with inserting values into a MySQL table called "section". This table consists of 5 columns, including one integer, one text, and three JSON arrays. The JSON array values are stored in variables 's', 'l', an ...

Storing information in a JSON file

Is there a way to save data in a JSON file without using a database? I want to store questions from the user interface, but I haven't learnt about databases yet. I know using a database would be more efficient. Does anyone know if it's possible to achieve ...

Is it possible to merge a dictionary with text file writing and then retrieve it as a dictionary once again?

I am making requests to a link and receiving JSON files as response. I am storing this data in a text file, but when I try to read it back, I want to interpret it as a dictionary. How can I achieve this? def url_sequence(limit=5): for i in range(limit ...

AJAX - transmitting JSON data unencoded over the network

PURPOSE & CONTEXT Analyze two text samples that describe different products. Sample 1 is extracted from a form textarea and sent via AJAX to compare it with Sample 2, retrieved from a database. I am experimenting with sending it as a JSON object beca ...

Why isn't my data appearing when using $http.get in AngularJS?

I'm encountering an issue where my bar graph doesn't display data when using $http.get. However, if I eliminate $http.get and directly call the URL, the data shows up perfectly. Any suggestions on what might be causing this problem? AngularJS var app = a ...

Display data retrieved from the server using AngularJS

I received the following JSON data from the server: {"start":"29-11-2014","end":"31-12-2014","pris":"372.27"} Within my .success function, I have $scope.paymentInfo = data; then I attempt to display it in my HTML view like this {{ paymentInfo.start }} H ...

Using Go to persist JSON logs by creating and validating unique filenames repeatedly

I am relatively new to Go and I find myself regularly receiving a small (~1KB) JSON file from an API that acts as a log. My goal is to preserve each of these files for future reference. Instead of using a database, which seems unnecessary for this task, I ...

Strip the quotes from the JSON output

Need help removing double quotes from my JSON output. Here's the issue: [{"id":"1","nom":"Magasin Jardins 2","ville":"Paris","latlng":["36.85715,10.127245"]} I want to remove quotes from the latlng value to get this result: [36.85715,10.127245] He ...

Deciphering JSON is not functioning as expected

I am looking to utilize and parse a list of radio stations from the CuteRadioAPI. You can find more information about it here. When making a GET request, the result I receive looks something like this: It appears that the structure is not exactly in JSON ...

Steps for Configuring the Content Type in an ActionController::TestCase Request

I attempted to make a GET request in my TestCase like this: request.env['CONTENT_TYPE'] = 'application/json' get :index,:application_name=>"Heka" However, it is failing with an error: ActionView::MissingTemplate: Missing template ...

How can one utilize JSON.parse directly within an HTML file in a Typescript/Angular environment, or alternatively, how to access JSON fields

Unable to find the answer I was looking for, I have decided to pose this question. In order to prevent duplicates in a map, I had to stringify the map key. However, I now need to extract and style the key's fields in an HTML file. Is there a solution to a ...

Mapping an array of dictionaries containing key-value pairs to a specific class using a string identifier

I am trying to work with an Array of objects that are retrieved from a string. The information is received in an encrypted form through an API call, and upon decryption, it takes the form of a JSON structure presented below: { "request_id”:”abcds ...

Choose the minimum price from the JSON response of the API

I have made an AJAX request to an API and received the following JSON response below. I am trying to extract the lowest 'MinPrice' from the 'Quotes' data but finding it challenging to determine the best approach. One method I am consid ...

Unable to access the Newtonsoft.Json file or assembly

My current project involves using Json.net in c# to create a json file. After building the code successfully, I managed to generate the parser.exe file without any issues. However, when attempting to run this parser.exe on a different server where it is in ...

Encountering a Jackson class not found exception in Spring MVC when working with JSON data

I am having trouble getting Spring's JSON support to work properly. In my spring-servlet.xml file, I have included the following lines: <mvc:annotation-driven/> <context:component-scan base-package="my.packagename.here" /> <context:ann ...

What is the best way to send an HTTP request in AngularJS to receive data in JSON format?

I am trying to create an AngularJS app that can send HTTP requests for JSON data. I have written the code in my index.html file to request JSON data using AngularJS, but for some reason, the JSON data is not being printed. When I check the console in Fire ...

When I try to load JSON data using the http.get() method in my Angular 2 template, it returns

I've encountered an issue while attempting to read and parse a local json file into a custom class I created. The problem arises when trying to access properties of the class, as it throws errors indicating that the class is either null or undefined. The ...

Determine the upload date of all channel videos using yt_dlp

Is it possible to extract the upload date in a json for all videos of a channel? I am looking to get a json output that includes the upload dates of all videos. Here is the code I have: import json import yt_dlp as youtube_dl options = {'ignoreerrors': Tr ...

Tallying the number of keys within the JSON

Here is an example of a JSON object: var json = { "pages": [{ "name": "page1", "elements": [{ "type": "text", "name": "question1" }, { "type": "text", ...

What is the best way to exclude fields when unmarshalling JSON in a Golang application?

In my program, I utilize a JSON file to set up the arguments and also use the flag package to configure the same arguments. Whenever an argument is parsed by both the JSON file and the flag at the same time, I prefer to use the argument parsed through the ...

Is it possible in Elasticsearch to dynamically construct and send a JSON query object?

Currently I am utilizing angularjs alongside elasticsearch.angular.js. Constructing a dynamic JSON query object to reflect user requests has been successfully achieved. I am now seeking assistance on how to pass this constructed object to the search API wi ...

Trouble with json_encode when dealing with a multidimensional array

I've been struggling to retrieve results from 2 queries in JSON format. Even though var_dump($data) is showing the data, using json_encode either returns empty results or doesn't work at all. $data = array(); $array_articles = array(); $sql_arti ...

Converting Ajax to JSON with Jquery offline and Manifest for enhanced offline web applications

Looking to create an offline web application, I'm in the process of transitioning from Ajax to JSON using JQuery offline. Here is the initial Ajax code: $.ajax({ url: contentpage, data: contentpagedata, cache: false }).done(function( html ) { ...

Revamping perspectives: the art of transferring values from a list to each individual map

I have been struggling with the jolt transformation and need help finding a solution I want each attributeList to have attributeType and attributeValue, along with a unique modelId where key names are case sensitive in the expected output Input [ { ...