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

PhoneGap and jQuery prove ineffective in fetching json results from Twitter

I've been working on a project to fetch the most recent 50 tweets with a specific hash tag. The project is built for mobile devices using PhoneGap (0.9.6) and jQuery (1.6.1). Below is my code: function retrieveTweets(hash, numOfResults) { var uri = "h ...

Transforming a Pyspark dataframe into the desired JSON structure

Is there a way to convert a Pyspark dataframe into a specific JSON format without the need to convert it to a Python pandas dataframe? Here is an example of our input Pyspark df: model year timestamp 0 i20 [2019, 2018 ...

Generating well-structured JSON response to be utilized in highcharts alongside Laravel is crucial for efficient data

In one of my views, I have integrated a highcharts chart and I am trying to load the data via ajax from an API route that returns a JSON response. Here is the API route I created: Route::get('api/v1/data/{id}', function($id) { //Perform som ...

What varieties of ajax styles are there?

Although I am still relatively new to utilizing ajax, I have found a lot of success in my endeavors so far. The majority of my ajax calls tend to follow this format: function saveQueryProf(){ var currentDate = new Date(); var date=currentDate. ...

Dealing with a distinct dynamic identifier in a JSON structure - what's the best approach?

Exploring json handling for the first time using retrofit to interact with an API. The unique ID "f9dcf2ef-8647-46c1-b1cc-7e2bb6c3caa2" varies whenever the username in the URL {username} is changed. { "status": 200, "foundmatch": true, "requested": ...

Is there a way to deserialize JSON into an empty struct within a function without losing its type information?

Can someone help me with a question regarding JSON unmarshalling? I am facing an issue where the type is lost after unmarshalling the data. Here's an example of what I'm experiencing: package main import ( "encoding/json" " ...

Documentation for RestKit JSON Metadata Response Descriptor

Upon receiving a JSON response containing a list of objects and a timestamp value labeled as "MetaData," the data structure looks like this -- { "access_time": 1416467865510, "profiles" : [ { "user_id": "bbb91ae431b", "email": "&l ...

What is the best way to transform a JSON object with various key-value pairs into a list using JavaScript?

There's a JSON string that I need to convert into a different format, here is the original: var jsonData = [{"label":"Hass1(<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="354d4d4d6a465058755d5a4158545c591b565a58">[email ...

A guide to dynamically extracting values from JSON objects using JavaScript

I have a JSON array with a key that changes dynamically (room number varies each time I run the code). My goal is to access the inner JSON array using this dynamic key. Here's what I've attempted so far, but it's throwing an error. Here is ...

Unleashing the Power of Python for Unraveling Insights from

I've been given a task to use Python for extracting data from a JSON file. The JSON file I have looks like the following: {"votes": {"funny": 15, "useful": 48, "cool": 18}, "user_id": "JkeCKyEaQlbLd9uZYl4DjA", "name": "LiiLii C.", "url": "http://www.yelp. ...

Leveraging the Yahoo Weather API

I have integrated the Yahoo Weather API and successfully retrieved data using the following link: Now, I am looking to implement this URL with Retrofit. Could you please guide me on how to dynamically change the city by passing a query? Thank you! ...

Combine and update JSON files by matching ID's in PHP

I am facing an issue with merging JSON files in PHP. I want to overwrite data when the id's match, but it's not working as expected. Here is my PHP code: foreach($instagram_array['data'] as $key => $image){ $id = $image['id']; $url = $image[ ...

Encountering a 400 error while making a Python request that involves

Below is the code I am using to register a user through an API endpoint: import argparse import requests import ConfigParser import json import sys import logging # Configuration Parameters env = 'Pre_internal' Config = ConfigParser.ConfigParser() Conf ...

What is the proper way to utilize express.json() and set headers (res.setHeader) at the same time?

I'm currently working on a POST request and need to both view the body of the request and set some headers. Specifically, I want to enable communication from localhost to localhost by adding Access-Control-Allow-Origin: * as a header. This is what my ...

What is the best way to apply a filter to an optional property value only when it is present?

I have JSON data like this: { "message": "hi" } However, the format could also be like this: { "message": { "action": "foo" } } My goal is to remove any records where message.action == "foo" I ...

How can JSON objects be structured to reflect the Map collection type for the specified pattern?

Creating nested HashMaps in Java can be a complex task but doesn't have to be. In this example, we have multiple levels of nested HashMaps with key-value pairs. Now the question arises - how do we serialize this data into a JSON object? If you have any in ...

Find the value of a JavaScript string variable using an alternative name

My latest JavaScript function is designed to fetch JSON data from either a server or local files on any browser. This piece of code processes JSON from two sources: an XMLHttpRequest response, or a variable imported via script. In the case of the latter, ...

Issue with PHP form submission not functioning within a table when utilizing jQuery

I've created a function that retrieves user data. function returnChild(){ global $pdo; $stmt = $pdo->prepare("SELECT * FROM children INNER JOIN districts ON children.ch_district = districts.dst_id ...

Accessing data in a JSON file can be done by

Similar Question: Reading a Json Array in android I am attempting to extract the field names from a string using JSON. While I have successfully retrieved the values, I am struggling to retrieve the field names. Here is an example: String strjson: { ...

Generate fresh columns from string columns formatted as JSON

I have a table with a single column that is of string type, but the content resembles a JSON structure. The data in the column looks like this: 'old_id' column with values: [{"name":"Entitas Penugasan","id":"6415","value":"HIJRA"}, {"name":"Function","i ...

Is there a way to retrieve a raw value from the API response that matches the one shown in POSTMAN, but my attempts have been unsuccessful?

Looking for some assistance with fetching data from a front-end (React) to the raw value in JSON. Specifically, I'm having trouble with the login functionality. When I input my email and password, the response should match what I see in POSTMAN, but instea ...

Creating a JSON Array in Java with CDL.toJSONArray is not possible

My CSV data has the following structure: Name,Title,Class,Users Global D&A,W,clLevel,"ADMIN" Template Manager,X,clLevel,"G,ADMIN" Test Manager,W,clLevel,"G,ADMIN" I am attempting to convert this data to JSON using Java, but I have not been successful ...

Merge the JSON data with the Node.js/Express.js response

Whenever I input somedomain.com/some_api_url?_var1=1 in a browser, the response that I receive is {"1":"descriptive string"}. In this JSON response, the index 1 can vary from 1 to n, and the "descriptive string" summarizes what the index represents. I am ...

New data received in Akka-Http was processed by converting it to a JSON object

Currently, I am working on completing a POST request by unmarshalling received JSON. I need to update the JSON data before submitting it to a Scala method. val route = (path("createDataSets") & post) { entity(as[DataSetEntity]) { dataSetEntity: Da ...

Having trouble saving a JSON object as a cookie in Next.js using js-cookie

I am having trouble setting user data along with a token ID in a Cookie. The token is set correctly and appears in the console.log output, but my user JSON object is not being properly set and only shows as "object Object" in the Cookies. However ...

Tips on locating information within a pre-existing GET array with parameters provided

Apologies for the unclear title. I am currently utilizing a category chooser that pulls categories from an API. The process involves fetching a list of categories, filtering out their names, and presenting them in the category chooser. Upon clicking submit ...

What is the best way to use cURL in a shell script to send a request with custom

When attempting to run a CURL statement, I successfully received the desired response: curl -s -POST --header 'Content-Type: application/json' 'http://www.dummy.com/projectname/page_relevance' -d '{"query": "q_string", "results": [{"abstract": "abs_string ...

What is the best way to handle parsing a JSON object in a single response?

My challenge lies in parsing/converting a GET response to a POJO. Below, I have the User class and the Controller class. In the getUsers() method, I successfully parse the request using ParameterizedTypeReference with the wrapper class. However, I face di ...

Building a structured JSON request using Jbuilder

My current JSON request is returning the following data, where each person/lender has multiple inventories. #output of /test.json [ {"id":13, "email":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a4cecbcccac0cbc1e4c1dcc5c ...

Using cURL for PHP JSON parsing

I am trying to develop a basic webpage that displays the current region based on the user's IP address. To achieve this, I am utilizing an API provided by freegeoip.net. Even though I have successfully configured the code to send the user's IP to the API a ...

Is it possible to deserialize the data {"number1":5L,"number2":5L} into a class with long data fields?

After I convert the JSON: {"number1":5L,"number2":5L} to a class with long fields, I encounter the following issue: JsonParseException: Unexpected character ('L' ): was expecting comma to separate Object entries Is there a solution to res ...

Dynamic urls from previous getJSON calls are utilized in nested getJSON calls

I am seeking assistance in finding a more dependable method for accomplishing this task. We are working with 3 fixed URLs that cannot be modified. The process begins with a getJSON call to url1 to retrieve all the sections. Within the callback function ...

Limitations on Embedding Videos with YouTube Data API

I have been using the Youtube Data API to search for videos, but I am encountering an issue with restricted content appearing in the results. Specifically, music videos from Vevo are showing up even though I only want videos that can be embedded or placed ...

Retrieve information using the GET method in REST API

I have a JSON file containing various data fields such as name, roll number, address, and mobile number. I am looking to display only the roll number and address information from this file using node.js. Can someone provide instructions on how to achieve ...

Using JavaScript to Retrieve, Manipulate, and Merge JSON Data from Various Files

My knowledge of JavaScript is limited, but I am interested in uploading multiple JSON files, processing them, converting them to text, combining them, and downloading them into a single JS file. I have successfully achieved this for a single file, but I a ...

Attempting to manipulate arrays by using the json_query method

I'm experiencing difficulties with using the json_query function to filter arrays based on a specific key value. When providing the direct path, this is the API result that is displayed: ok: [localhost] => { "msg": [ { ...

Struggling to properly structure WCF JSON data for HighCharts integration?

I am having issues binding my WCF JSON data to HighCharts Pie. When I hardcode the data, it works fine but dynamic data processing does not seem to work. Original from WCF -[{"AllRecordsUrl":"http:\/\/EMS\/sites\/IST\/report.aspx ...

Stop the slider when a video pops up

Years ago, I had a slider created for me that supports both images and video with a timer. However, the issue I'm facing is that when the timer runs every 10 seconds, the video gets cut off if it's not finished playing. Below is the json file structure: ...

What is the best way to extract all the values from this Json in order to perform an Assertion

As I work with a JSON response received as a string, my aim is to create a versatile Assertion method for verifying if a property name matches the correct value. However, extracting the entire JSON data has proven challenging, as only the first set appears ...

"Unable to locate package.json file when trying to run NPM install

When setting up a workflow on Github, I encountered an issue while running the npm install command: npm WARN saveError ENOENT: no such file or directory, open '/home/runner/work/project/project/package.json' npm notice created a lockfile as package-lock.js ...

Traversing a multi-dimensional array with changing keys in PHP

Recently delving back into the world of basic PHP, I encountered a roadblock while dealing with a JSON response. I successfully converted the response into an Array, but it seems to be multi-dimensional. The challenge lies in isolating and extracting value ...

There was an issue with parsing the data due to a JSONException stating that the value of type java.lang.String cannot be converted

I've been encountering an error while working with PHP, MySQL, and JSON for the past two days. Here are the snippets of my code: require "includes/connexion.php"; $requete="SELECT * FROM contacts;"; $rep=$pdo->query($requete); while($data=$rep-&g ...

Are Viewmodel contents empty after ajax request?

Currently working on an ASP.NET MVC application, I am in the process of developing a search page that showcases both the search box and the table of results simultaneously. To achieve this functionality, I have utilized Partial Views along with AJAX/JSON c ...

Show unique field data characteristics encoded in multidimensional arrays in WordPress

Looking to showcase a custom field meta_key value from WordPress. The information is stored as a custom field meta_key value in WordPress $data = get_post_meta( get_the_ID(), 'data', false); print_r($data); Array ( [0] => [ { "title":&quo ...

Error encountered while parsing JSON data with Gson: MalformedJsonException

Hello, I am working on a project that involves parsing JSON data. However, I keep encountering a Malformed exception while trying to do so. Below is the code I'm currently using: Object listOfGroups = sthService.getSthList(); Gson gson = new ...

Issue with JSON parsing on non-Chrome web browsers

Encountering a problem with parsing fetched JSON data from browsers other than Chrome, Firefox providing error message: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data". Notably, code functions in local node.js environmen ...

The ImportJSON Function output is not compatible with other cell functions

Is it possible to utilize the value from a cell that uses the importJSON function in other cell formulas? For instance, if Cell A1 contains =importJSON("url", "/name", "noHeaders"),1,1) and displays a value of 100, can I then ...

Comparing the syntax of JSON to the switch statement in JavaScript

I recently came across a fascinating post on discussing an innovative approach to utilizing switch statements in JavaScript. Below, I've included a code snippet that demonstrates this alternative method. However, I'm puzzled as to why the alternate solut ...

I'm looking to access the Yahoo Weather API data through the JSON object's channel -> item -> forecast -> {day1} {day2} {day3} {day4} {day5}. How can I do this retrieval?

I attempted to access the forecast data but encountered issues, specifically a NullPointerException and sometimes crashes. This is because I am unable to retrieve the data from item -> forecast -> {data}. Within the Item class: condition = new ...

Retrieving specific JSON data using jQuery GET method and specific values

Here is the code snippet I am working with: $.ajax({ url: 'api/api.php?getPosts&lat=' + latitude + '&long=' + longitude + '', type: "GET", dataType: "html", success: function (data) { ...

What is the best method for seamlessly loading JSON data while transitioning between pages in a jqtouch application?

I've been working with JQTouch for my application. While the demos showed how to retrieve an html file and display it in the user interface, I'm dealing with loading JSON data that I want to incorporate into an existing DIV element. I prefer not ...

How to parse an array in JSON using Swift 3 and iterate through it

Figuring out how to parse JSON data in Swift 3 has been more challenging than I anticipated, especially coming from a Javascript background. Received response from API: [ { "ID": 1881, "image": "myimageURL", }, { "ID": 6333, "image": "myi ...

Trouble with parsing JSON in PHP

I've been encountering issues with a PHP script I recently created. The problem lies in my inability to retrieve data from a JSON file named demo.json using PHP. Below is the content of the JSON file: { "checkouts":[ { "billing_address":{ ...

How to use regular expressions to retrieve the ID of the object with the status "waiting" in a JSON array

Looking to extract the ID of an object from a JSON response using regular expressions. The JSON response contains an array of objects as shown below: ... { "Id":"01", "Subject":"Sub", .... "Status":"Completed" ... }, { "Id":"02", "Subject":"Sub", ...

Mastering the art of looping through JSON values using AngularJS ng-repeat

Is there a way to use ng-repeat in order to iterate and access the name values: test01, test02, and test03 from my JSON data? Any guidance on how to achieve this using ng-repeat would be greatly appreciated. Thanks in advance! Check out this Fiddle link. ...

Utilize shell scripting on Linux to parse JSON data

Similar Question: Parsing JSON using Sed and Awk I have an example of a JSON string provided below. I am interested in extracting the value of the "uptime" field to use as a variable in a shell script. How can I achieve this? { "serverStatus" : { " ...

Retrieve the non-empty attributes of a JSON object

I have a function in Typescript that extracts specific values from a JSON data object, some of which may be empty. How can I retrieve only certain data fields? Here is the function: let datosCod; for (let get in Object.keys(transfConsData)) { co ...

Generate a new JSON reply using the current response

I received a JSON response that contains values for week 1, week 2, week 3, and week 4 under the 'week' key, along with counts based on categories (meetingHash) and weeks. I attempted to merge this data using the .reduce method but without succes ...

What is the best way to format WIQL JSON?

When using Postman, I have no trouble submitting a query to our Azure DevOps 2019 Server: POST https://<AZDOSERVER>/<COLLECTION>/<PROJECT>/<TEAM>/_apis/wit/wiql?api-version=5.0 {"query": "Select [System.Id] From WorkItems WHERE [Sy ...

The proper way to send a string array parameter to an MVC WebApi controller

Starting my journey with AngularJS, I'm faced with the challenge of passing a JSON object that includes an array of strings to an MVC WebApi GET method. However, no matter what I try, I cannot seem to get the WebAPI controller to receive the correct v ...

Creating a double-layered donut chart with Chart.js

I'm attempting to create a unique pie chart that illustrates an array of countries on the first level and their respective cities on the second level. After modifying the data in a JSON file to align with my goal, it doesn't seem to be working a ...

Transforming the MySQL result array into JSON format

I am looking to transform the array result retrieved from my database query into JSON format using PHP. Below is the code snippet I am currently working with: $row = mysql_fetch_array($result) My goal is to convert the variable $row into JSON format and t ...

What is the best method for saving a JSON resource on my device?

When I make a JSON request, it provides me with various parameters, one of which is the name. I want to create a variable to cache this name parameter so that I can access it later in my app. For instance, if the name from JSON request is "david", I would ...

Dealing with Array Problem in iOS Swift 3 when converting Object to JSON

public class LessonAssignment { private var title : String? private var category : String? private var week : Int? private var day : Int? //Title public func getTitle() -> String { return title! } public func ...

Tips for showcasing JSON data within an array of objects

I'm trying to work with a JSON file that has the following data: {"name": "Mohamed"} In my JavaScript file, I want to read the value from an array structured like this: [{value: "name"}] Any suggestions on how I can acc ...

JavaScript JSON YouTube API viewCount function is not functioning correctly

I'm struggling to retrieve the views of a video using JavaScript (Chrome Extension). Here is the code I have so far: $(function() { $.getJSON('http://gdata.youtube.com/feeds/api/videos/H542nLTTbu0?alt=json',function(data) { $.each(data.f ...

Utilize Angular's grep or filter method to retrieve an object based on its unique identifier

I have a collection of Category objects stored as a JSON array in vm.data within my controller for an Angular repeater. Now, I want to access the SubCats within each category by using the 'Category' field in each SubCat. Below is a generic funct ...

The application appears to be overloaded with tasks on its main thread, potentially causing errors

I am currently in the process of developing an app for user login and registration. The app relies on receiving a JSON response from a webservice to interact with the database. However, during the registration process, I encountered the following error mes ...

Guide to extracting video views from Instagram JSON data

I'm currently working on extracting the likes count, comments count, and video views from Instagram JSON data. While I've been able to successfully retrieve likes and comments counts, I'm having trouble figuring out how to access the video views data. Li ...

How can one transform a json object into a json string and leverage its functionalities?

I recently encountered an issue with a JSON object that contains a function: var thread = { title: "my title", delete: function() { alert("deleted"); } }; thread.delete(); // alerted "deleted" thread_json = JSON.encode(thread); // co ...

Decoding a JWT Base64 string into JSON format

While attempting to convert a base64 encoded JWT header into a string, I encountered an unexpected output: {"alg":"RS256","typ":"JWT","kid":"1234" The output seems to be missing the closing bracket. However, when I decode the same base64 string usi ...

A guide on utilizing Linq to read a Json file in c#

I have a JSON file with role_to_secrets for "rec" and need to retrieve the corresponding secret values for the "prod" environment. For example, if roles under "rec" are "resdns", "dnsmoon", and "resmoon", I should fetch the matching secrets for "prod": " ...

The File plugin in Ionic 3 is encountering difficulties in writing files on the device

I am developing an app using Ionic 3 and the file plugin. My goal is to write a JSON string to a JSON file located in my assets folder with the following hierarchy: assets -> mock -> msg-list.json , with "assets" as the main folder in the Ionic files. Wh ...

Sorting of dates in mui-datatables is not accurate

I have dates that are formatted using moment.js, for example ("Sat, Feb 22, 2020 12:55 PM") I retrieve them from firestore, and they appear to come in correctly as I first sort them in descending order. forms.sort(function(left, right) { return moment.u ...

Decoding with Gson: Say No to Wrapper Classes

Working on deserializing the JSON data provided using Gson in Kotlin. { "things": [ { "name": "Thing1" }, { "name": "Thing2" } } } Currently, there are two classes involved in deserialization; ThingWrapper - Contains a p ...