Linked Questions
52 questions linked to/from How to iterate over a JSONObject?
0
votes
1
answer
4k
views
Print data of JSONObject in java. [duplicate]
I have a JSONObject consisting of a simple json document(doesn't consists nested objects or JSONArray). I want to print that data.
import org.json.JSONObject;
import java.util.Scanner;
public class ...
0
votes
1
answer
2k
views
How to get value of key in JSON object [duplicate]
I have a json file which will update every so often and an example of it is this;
{
"Meta Data": {
"1. Information": "Intraday (60min) prices and volumes",
"2. Symbol": "ASX:NAB",
...
-3
votes
3
answers
589
views
How to get data from key of a JSON [duplicate]
I am creating an app in which i need to parse a list of contacts which is in JSONObject format, with key before each object, i don't know how to parse this format.
{
"1": {
"mobileContact": "...
-1
votes
2
answers
386
views
How do we pass JSONObject as string in getJSONArray();? [duplicate]
I want to fetch multiple JSONArray from an JSONObject
JSONObject jsonObject=new JSONObject(response_view);
for(int x=0; x<jsonObject.length(); x++) {
JSONArray jsonArray = jsonObject....
0
votes
1
answer
464
views
iterate over .json file and print all values in JAVA [duplicate]
this is a prices.json file which contains many products prices
i need iterate over this .json in order to compare with another json output from another system
i need to get only the fields
"MATNR" ...
1
vote
1
answer
172
views
I am trying to read the JSON file and print the values of each object within array, but I am having incorrect output. What did I do wrong? [duplicate]
So, I am using json-simple library in my project, and this is what I have right now: (I just want to print out each of the objects from the JSON file)
import java.io.*;
import java.util.*;
import org....
0
votes
0
answers
125
views
How to get a json item from a subitem in java [duplicate]
I have this json object and i need to know the "package" of a given "name", for example, i need to know the package, of "item2", in java code
{
"package1": {
...
116
votes
5
answers
119k
views
Android JSONObject - How can I loop through a flat JSON object to get each key and value
{
"key1": "value1",
"key2": "value2",
"key3": "value3"
}
How I can get each item's key and value without knowing the key nor value beforehand?
15
votes
5
answers
14k
views
In Java is it possible to create a type-safe Map of classes to instances of their class?
I would like to create a map that uses a class as a key to return an instance of that class. Something like:
<T> Map< Class<T>, T > instanceMap = new HashMap< Class<T>, T &...
Sled's user avatar
- 19.2k
10
votes
2
answers
24k
views
JSONObject to Document
Hi there i am new with mongodb and i want to convert JSONObject to Document and then store it to mongodb.
Here is what i have coded.I get a service api in json.
CloseableHttpResponse response = ...
10
votes
7
answers
23k
views
GSON. How to convert json object to json array?
Now I am getting this JSON from API:
{"supplyPrice": {
"CAD": 78,
"CHF": 54600.78,
"USD": 20735.52
}}
But prices are dynamic, that's why I need JSON in this form
{
"...
2
votes
2
answers
14k
views
JSONObject data foreach (Android)
My following json data:
{
"Alex": {
"id": "54e23a2331ac67b1490d87b8",
"desc": "bla bla",
"no": 2
},
"Kodie": {
"id": "...
1
vote
3
answers
31k
views
JSONObject to JSONArray
I need some help here. I am still new in android developer.
Here is example of the data
strAPI_TERMINAL= "{ 'terminal': { 'id': 2, 'fmt_id': 'fmt0002', 'terminal_type': 'multiple' }}"
I need to ...
0
votes
5
answers
10k
views
Android: Dynamically Get JSON Array Key Name From JSON
I have a json link, if we open it I get a following result
{
"Status": "Success",
"All_Details": [{
"Types": "0",
"TotalPoints": "0",
"ExpiringToday": 0
}],
"First": [{
"id": "0",
...
-1
votes
2
answers
13k
views
How to get multiple specific values from a key in a JSON Object
So right now I am trying to get information from the logged in user through Facebook graph api.
{"id":"10202628284866677","name":"Rohit Tigga","link":"https:\/\/www.facebook.com\/app_scoped_user_id\/...
user avatar
anon