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).

Parsing Json into Kotlin Data Class with GSON

I am working with a Java POJO class that looks like this: class Topic { @SerializedName("id") long id; @SerializedName("name") String name; } In addition, I also have a Kotlin data class structured as follows: data class Topic(val id: L ...

Troubleshooting an issue with updating JSON data in PostgreSQL

There is a table with a json column called "stats" that has the value: {"countValue":0} I am attempting to update this value by: UPDATE my_table SET stats = jsonb_set(stats, '{countValue}', 1); However, I am encountering the following error: No functi ...

Jackson: Using JSON to convert values into keys

In Jackson, typically we define getters and setters in a class to print it as a JSON object. For example: public class MyClass { private Integer a; private Integer b; public myClass(Integer a, Integer b) { this.a = a; this ...

How can you extract a JSON object from a JSON array based on a key that is associated with a specific JSON

Is it possible to retrieve a specific JSON object from an array of JSON objects based on a condition? [ { id: 1, name: "larry" }, { id: 2, name: "curly" }, { id: 3, name: "moe" } ] For example, if I want to extract the object where name is equal to " ...

What is the method for retrieving information from a JSON file that has been uploaded?

I am working with some HTML code that looks like this: <input type="file" id="up" /> <input type="submit" id="btn" /> Additionally, I have a JSON file structured as follows: { "name": "Jo ...

transmitting data using the PUT method in JSON format

My goal is to send the JSON string {'post_id': 3} to my server using a PUT method. However, I am encountering a 500 error from my server when I run it. Can someone please confirm if I am sending the JSON data correctly? HttpClient httpclient = new D ...

Mastering communication between Android devices and handling complex data structures through socket programming

Recently, I've been exploring Android and I have a task at hand to establish a TCP socket connection and listen on a specific port. The client application will be sending me 2 images along with a related string. Instead of transmitting each piece of d ...

PHP Unleashed: Unraveling the Mysteries

What is the Best Way to Extract Data from This Array? I Need to display the First Object of My Array, Specifically the id field in the 3rd Row. <?php $con=mysqli_connect("localhost","root","","arrayy"); // Check connection if (mysqli_conne ...

Obtaining JSON data in a separate JavaScript file using PHP

I have an HTML file with the following content: // target.html <html xmlns="http://www.w3.org/1999/xhtml"> ... <script src="../../Common/js/jquery-ui-1.10.3.js"></script> <script src="../../Common/js/select.js" type="text/javascript"& ...

Anticipate the arrival of the getJSON response

Currently, I am working on a script that utilizes Yahoo's YQL within a web application. This script is designed to scan through a text paragraph, identify references, and display them as popups within the text. Everything works smoothly until I reach ...

Retrieving information from a JSON object that includes arrays

I've been researching how to extract data from the response body of a server, but I haven't had much luck finding a solution that works for my https request returning a JSON object. //Initiate the request: request({ //Specify the request method: met ...

Incorporate a refresh button into the JSON table view that includes an activity

How can I implement a refresh button in my app that displays an activity indicator when pressed? I have written the following code: In this app, I am using JSON to retrieve data from a server and I want users to see updated content when they press the re ...

The search bar in Laravel is encountering an Uncaught ReferenceError with AJAX

I'm attempting to create a real-time search bar for my products list, but I keep encountering an error in my console Uncaught ReferenceError: data is not defined at HTMLInputElement.<anonymous> (produits:243) at HTMLDocument.dispatch (jquery-2.2.4.mi ...

Flask API does not recognize elif and else conditions

Creating a flask API that deals with various nested JSON files presents an interesting challenge. Depending on the data within these files, different actions need to be taken. The sorting logic is based on conditional statements as shown below: if (jsonFi ...

Leveraging JsonPath to retrieve data without prior knowledge of the key

I have a Json string that looks like the following: "files": { "fileA.c": { "size": 100 }, "fileB.txt": { "size": 200 } } My goal is to extract the names of the files, {"fileA.c","fileB.txt"}, using JsonPath. It& ...

Error is being returned by the JSONP callback

Looking to grasp JSONP. Based on my online research, I've gathered that it involves invoking a function with a callback. Other than that, is the way data is handled and the data format similar to JSON? I'm experimenting with JSONP as shown below, but I'm ...

Parsing JSON file using U-SQL

Can anyone assist with parsing this Json file using USQL? I keep encountering errors. Json file@ {"dimBetType_SKey":1,"BetType_BKey":1,"BetTypeName":"Test1"} {"dimBetType_SKey":2,"BetType_BKey":2,"BetTypeName":"Test2"} {"dimBetType_SKey":3,"BetType_BKey" ...

Using jQuery to search for corresponding JSON keys in the PokéAPI

Currently, in my development of an app, I am searching for and implementing an English translation of a language JSON endpoint using the PokéAPI. The challenge lies in identifying the correct location of the English language key within the array response, ...

Parsing JSON responses for either arrays or objects

Struggling with a design issue using Gson as my parsing library while creating a library to consume a Json API. One of the endpoints returns an array of objects under normal circumstances: [ { "name": "John", "age" : 21 }, { "name": "Sar ...

Ways to utilize the image string obtained from the .getExtra method

I have successfully created a listview in my app and parsed JSON data into it, including images and text. Now I am facing an issue where I need to pass the image to another activity when the user clicks on it. I can easily pass text data using putExtra, bu ...

JSONArray rewrites its contents

I am trying to generate an Array using the following method: json = new JSONObject(); jsArray = new JSONArray(); for (int i = 1; i < j; i++) { CheckBox checkBox = (CheckBox) findViewById(i); if (checkBox.isChecked()) { try { ...

Comparing MVC's return Json() Method to JSON-Based Web Services

I am eager to offer a service on my website that allows any user to request JSON data. Ultimately, I hope that users will utilize this service frequently. My website is built using the asp.net MVC framework and I am exploring the best approach for accompl ...

Angular app sends a JSON request and receives no data in response

It seems like Angular may be loading the page before fully receiving all the information from JSONP. There are times when refreshing the page multiple times eventually displays the information, but it's not consistent. Interestingly, the code used on my pr ...

Exploring JSON Deserialization and Parsing in Android Development

Can someone clarify the concept of "deserializing Json" for me? I've come across this term online but am unsure of its meaning. Any explanation would be greatly appreciated. ...

Can you retrieve the second value using JSON.stringify?

Currently implementing JSON.stringify(data.message) which returns the following value: [ { "code":"PasswordTooShort", "description":"Passwords must be at least 6 characters." } ] I aim to extract the description value for my alert message ...

Unexpected behavior: JQuery Ajax request not displaying Json object following recent update to JQuery version 1.10.2

Currently facing an issue with a project I am working on. The previous programmer used jquery 1.4.4, and I have updated it to 1.10.2 due to the designer using Bootstrap. However, after running it in version 1.10.2, one of the objects that was functional i ...

How can I establish a connection between my Android app and a PHP server using HTTPUrlConnection to send data in the output stream and ensure that the server receives it in the $_

When using HttpURLConnection to send a JSON query to a PHP server, I encountered issues with the communication not working as expected. Despite having a successful connection and receiving proper error responses from the server side, it seems that the PHP ...

The JsonDeserializationException encountered an error while attempting to deserialize the object

When receiving data from the BackEnd, it typically looks like this: {name : String, author : String, updater : String, media : String, } Sometimes, the 'media' field can also be an array with a different structure, but unfortunately I am unable to mod ...

The use of event.returnValue is outdated and no longer supported. It is recommended to use the standard event.preventDefault() method instead. You may encounter

Hey there :) Currently, I am utilizing JQuery 1.9.1.js to search records using JSON. I am able to retrieve the search list locally, but when attempting to publish it on Windows Server 2008 and IIS 7, I face issues as it throws an error stating "event.ret ...

I am facing an issue where I am unable to view JSON objects despite utilizing json2html library

Currently, I am facing a minor problem while trying to incorporate json2html into a project. Despite running the transform function successfully, it is not including the JSON objects as expected. In my setup, I execute a call to MongoDB, retrieving the JS ...

Making an HTTP POST request in AngularJS

Upon sending a POST request with headers specified as content-type: application/JSON, the cookie is not being set in the Request Headers. However, when I modify the headers to be content-type: application/x-www-form-urlencoded, the cookie is successfully ...

How to retrieve data from a JSON file in Angular 2 using the http get

I am encountering an issue while trying to access a json file using http get. The error message I receive is as follows: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterable ...

Utilizing jQuery's POST Method to Fetch JSON Data on a Website

I've developed a Java REST API and now I want to retrieve JSON data on my website (which is built using HTML & CSS) by utilizing jQuery. The method to be used is POST, and here is the structure of my JSON: { "sessionID" : "25574", "interactiv ...

Java REST service remains out of reach for JavaScript fetch call

Currently, I am in the process of learning about REST API. My goal is to make a call to a POST service implemented in Java from Javascript using fetch. However, I have encountered an issue where the request fails to reach the service whenever the @Produces ...

Create a new JSON file and add data using ObjectMapper

My current project involves delving into Jackson to gain a better understanding of how it works. I am in the process of creating a simple program that can both read from and write to a file, specifically storing JSON data in it. This project revolves aroun ...

What is the best way to transform a JavaScript object into a JavaScript literal?

Currently, in my nodejs project, I have an object defined as follows: const objA = { key : 'value' }; My goal is to create a new file named obja.js which should contain the same literals from the object, rather than as a JSON literal. How can I accomplish ...

Retrieve information in JSON format from a document

I'm trying to extract data from a JSON file without knowing the exact location of the data. Here is an example JSON: var names= [ { "category":"category1" , "name1":"david", "name2":"jhon", "name3":"peter" }, { "category":"catego ...

Serve vast in-memory array using ESPAsyncWebServer

I am attempting to serve a sizable float array with 8192 values from the ESP32 Heap using the ESPAsyncWebServer library for ArduinoIDE. The microcontroller I'm using is an ESP32 devkit c, and my goal is to access the array through a web browser. Here is th ...

Steps to upload an image using an API

I am attempting to use an API to upload a file to imgBB, but I encountered the following error message: {"status_code":400,"error":{"message":"Empty upload source.","code":130},"status_txt":&q ...

Dynamic JSON property addition in C# at runtime

Below is an example of my JSON structure: [ { "id": "test.txt", "fields": { "_str.application": [ "Text File" ], "_str.body": [ "asdsadasd" ], "_str.mimetype": [ "text/plain" ] } } ] Is there a way to dynamically add new ...

Using spaces in JSON key names can create potential compatibility issues

I have a JSON structure that needs to be displayed in a table with specific keys and values. The key names contain spaces, such as "PAY ALL", "PAY PART", "DECLINE", and I need to show the corresponding values for each in the table rows. How can I achieve t ...

Unlock the secret to retrieving specific properties from a JSON object

Whenever this code is executed: import requests import json def obtain_sole_fact(): catFact = requests.get("https://catfact.ninja/fact?max_length=140") json_data = json.loads(catFact.text) return json_data['fact'] print(obtain_sole_fact() ...

Creating Lists with Construct2

I'm struggling to display a list of games assigned to a user in Construct2. As a beginner with the program, I am unsure of how to achieve this. My understanding is that I need to utilize the AJAX function to fetch data from an external source in JSON ...

Data fields in BigQuery are automatically converted for ease of use

Insight When uploading JSON data to a BigQuery table with autodetect enabled, I encountered an issue where the field "a" could not be converted to an integer. Upon further investigation and modification of the JSON data, changing values in the "a" field ...

Changing the value of an object property (illustrated using a basic linked list)

I am working on a JavaScript Link List implementation as a beginner, and I have written the following code: var LinkList = function () { this.LinkedList = { "Head": {} }; }; LinkList.prototype = { insert: function (element) { var Node = this ...

Experiencing an error of undetermined nature in the bulk messaging application

I've been working on an app that can send mass texts by using a JSON file containing numbers and names. However, every time I try to test load the app in IRB, I keep encountering this error message: NameError: undefined local variable or method `data_from ...

Troubleshooting JavaScript Date Problem with Internet Explorer 7

When I retrieve a Date from a web method, it comes in the format of "Mon Sep 30 07:26:14 EDT 2013". However, when I try to format this date in my JavaScript code like this: var d= SomeDate.format("MM/dd/yyyy hh:mm:ss tt"); //Somedate is coming from the we ...

Guide on incorporating curl in Java and extracting JSON feedback

Is it possible to use a curl command that provides a JSON response in Java and parse the JSON response using Java? Here is an example of Java code attempting to achieve this: public static void main(String[] args) throws Throwable { try { In ...

Using iOS to send a request - Receiving a response with a 304 HTTP status code from

I am currently in the process of developing an application specifically designed for iPad users. To create this app, I am utilizing Express and a restful approach as the backend framework. The code snippet below demonstrates how Express should respond on t ...

Navigating through filenames using Python

With a collection of 200 JSON files in Python named "1.json", "2.json", "3.json" and so on, I set out to apply modifications using a loop. Unable to achieve the desired result using "for i in range(1, 200):", I decided to pursue an alternative method. my ...

Sharing data between AngularJS and D3 with JSON - a guide

When working on my application controller, I typically send a request to my API. This is what it usually looks like: .state('state1', { url: '/datas/:id', templateUrl: 'myurl.com', title: 'title', controller: function($http, ...

Exploring the world of JSON communication through MVC Web API: A comprehensive guide

Similar cases to mine have been answered before, but my specific needs always seem to differ from others' problems. I am facing an issue where I'm sending JSON data from my HTML page to the MVC Web API, but unfortunately, the data I receive is always null ...

JSONP OpenWeather API

I've been trying to access and retrieve weather data from OpenWeather using their API, but unfortunately, I'm facing some difficulties in getting it to work. It seems like there might be an issue with the way I am fetching the JSON data. To quer ...

Converting intricate JSON documents into .csv format

I have this JSON file containing a wealth of information about football players and I am trying to convert it into a .csv format. However, as a beginner in this field, I am facing some challenges! You can access the raw data file at: https://raw.githubuse ...

How can I send data in JSON format to a JavaScript AJAX request?

I've created a method that looks like this: public String getUTResult() throws IOException { BuildResultParser bp = new BuildResultParser(); BuildResultBean b = bp.getreadFile("C:\\bc.txt"); String str = b.getuTresult(); ...

Utilizing a FutureBuilder for fetching JSON data in a Flutter DropDownButton

I have been developing an app using Flutter and I am currently working on implementing a Dropdown Button that will display values received from a JSON response via an API built with Django. Here is the JSON response: [{"name": "FC1", "username": "admin"} ...

How can JavaScript/jQuery be used to update LocalStorage Objects when editing a form?

Having trouble pinpointing an issue with my code. Despite making modifications, the values in localStorage are not updating as expected. Any suggestions on what may be causing this problem? Note: Changing const idx to const i resulted in only the final va ...

Obtaining an image from encoded JSON information

This inquiry pertains to Visual Basic .NET 2010 How do I extract the image from this encoded JSON string? What type of encoding is being used here? I'm attempting to capture a screenshot of a website using the Google PageSpeed API. "screenshot": { ...

The AJAX request to the REST service is failing to trigger the success function in the AJAX call

Struggling with some issues related to AJAX, specifically when calling a Java REST server that I've developed. While I am relatively new to AJAX, I have put in quite a bit of effort searching for solutions. The problem arises when making a call from a test ...

"Prior to encoding the MySQL array, it is essential to have an

I'm having trouble getting a verification array to load before the mysql array in json_encode. Here is the Array I want displayed before the mysql array: "array("status":"true","message":"Data fetched successfully!","data":" However, when I try running the ...

The WCF Service is experiencing issues when attempting to call a client for accessing REST with JSON, as the correct content type is

I've been struggling with a perplexing issue for the past few days - I'm trying to utilize a WCF service to call another RESTful service. However, as I trace through the process, it consistently fails to set the appropriate JSON content type on the messag ...

What is the best way to serialize a method within a model?

Is there a way to serialize the get_picture(self) method within this model? I am currently working on a social networking project and I need to serialize this method in order to obtain a JSON URL for the user's profile picture to be utilized in an And ...

Omitting certain values in jackson

I am currently working with Object Mapper and I am seeking a way to exclude certain fields based on specific values. Imagine having an object structured like this: public static class Data { int id; int value; } Let's assume that the value ...

Error encountered while attempting to load JSON data into HTML audio element

I need to incorporate data from a JSON file into an HTML audio tag. While I've been able to extract the desired information from the JSON, I'm facing difficulty loading it into HTML. Here's what I've tried so far: <?php $json = file_get_contents('http: ...

Creating specifications for query parameters in Loopback that are essential for handling CRUD operations

Our journey with Loopback has been successful thus far, but we are now looking to enhance our API documentation by including query parameters. In the swagger.json file, there could be a section that resembles this: { "swagger": "2.0", "i ...

Leveraging oembed for dynamic content integration with SoundCloud in JSON

I'm looking to retrieve the latest 10 tracks of a user using oembed with json. $.getJSON("http://soundcloud.com/oembed", {url: "https://soundcloud.com/aviciiofficial", format: "json"}, function(data) { console.log(data.html); }) The data.h ...

Unable to retrieve JSON data from a PHP file hosted on the server

I have a server-side database with a table called "customers" and a column named "names". My goal is to send a request to the server asking for the first two records in the "customers" table. However, when I execute the program, the browser does not displa ...

Performing an Ajax post request to a PHP script in order to retrieve a PHP variable using XMLHttpRequest

I am looking to dynamically update my table using JavaScript every few seconds. Currently, I have set up an AJAX post request to my update.php file and trigger it if it is set. Then, I execute a MySQL query to retrieve the data and store the resultset in ...

Filtering MYSQL query results based on the result of an alias (AS)

Here is a MySQL query that I'm working with: SELECT t1.*, (SELECT count(*) FROM tb_pt t2 WHERE t2.id_provinsi = t1.id_provinsi && nama_pt LIKE '%$nama%' && status_pt = 1 ) As jumlah FROM tb_provinsi t1 WHERE status_provinsi = ...

Is there a way to convert a flat JSON into several instances of a sub-class through deserialization?

Here is a flat JSON string that needs to be deserialized in Java using Jackson: {"ccy":"EUR", "value1":500, "value2":200, "date":"2017-07-25", "type":"", ... <many other pairs>} To deserialize this JSON string, we can create the following ...

Efficiently loading data using lazy loading in jsTree

I have been facing a challenge with dynamically loading the nodes of a jtree upon expansion. The limited documentation I could find is located towards the end of this specific page. Several solutions involve creating nodes individually using a loop, simil ...

The Ajax call failed to connect with the matching JSON file

<!DOCTYPE html> <html> <body> <p id="demo"></p> <script <script> function launch_program(){ var xml=new XMLHttpRequest(); var url="student.json"; xml.open("GET", url, true); xml.send(); xml.onreadystatechange=fun ...

Is Angular capable of displaying a date within a specific timeframe using ng-show?

So I have a button that, when clicked, displays a list of data. I am adding a unique font awesome icon in there if the JSON key value exists. However, here lies the issue. The particular key happens to be a date. I need my ng-show function to check whether ...

GSON - Decoding JSON Obtained through Wikipedia API with Dynamic Object Naming

{ "batchcomplete": "uniqueText123", "continue": { "grncontinue": "0.262157292819|0.262157407383|17998004|0", "continue": "grncontinue||" }, "query": { "pages": { "54321098": { "pageid": 54321098, "ns": 1, ...

Guide on Importing mongodb dump files(bson+json) in a Windows system

I recently exported MongoDB dump files from my CentOS7 server in both .bson and .json formats. Now, I am trying to import them into my MongoDB on Windows 10. Despite setting an environment variable with the name "mongorestore" and value ".../mongorestore ...