我刚开始使用JSON,我的问题可能不是很难回答,但我无法找到解决我的目的的方法。我正在开发代码,以便能够管理一些JSON内容。在我的例子中,JSON信息是:
{"posts":[{"id":1a00b,"name":"Michael Thomson","info":"he is crazy"},
{"id":18,"name":"Jason Williams","info":"he is tall"}]}
现在,我想从每
我正在尝试从服务器获得JSON响应,然后在我的android中显示它,但是由于解析错误而失败了
由: org.json.JSONException: Value {"Result":"Login“、"User_Name:":"Ayan"}引起的org.json.JSONArray类型的Android错误不能转换为JSONObject
我无法手动解析此JSONObject。
val client = OkHttpClient()
val mediaType = "application/x-www-form-urlencoded".toMediaTypeOrNull()
val body = RequestBody.create(mediaType, "query=${listItemName}")
val request = Request.Builder()
.url("https://trackapi.nutritionix.com/v2/natural/nutrien
我正在将一个数组从php保存到android中,并且我收到了以下字符串格式:
["Rick","Anne","Carl"]
但是当我执行的时候:
JSONObject myjson = new JSONObject(the_json);
我得到了:
org.json.JSONException: Value ["Rick","Anne","Carl"] of type org.json.JSONArray cannot be converted to JSONObject
为什么?我将数组从ph
我从volley库得到了这个错误
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
}
误差
com.android.volley.ParseError: org.json.JSONException: Value [{"id":"admin","name":"Admin"}] of type org.json.JSONArray cannot be converted to JSONObject
如何以字
我正在从我在php文件中分配的数组中提取数据。从Array输出中提取数据时出错。产出如下:
org.json.JSONException: Value [{"program_dosya":"..."},{"program_dosya":"https:..."}, `{"program_dosya":"https:\/\/..."}] of type org.json.JSONArray cannot be converted to JSONObject`
我想提取通过android在数组中分配的“程
我想从JSONObject获取“天气”数据,但这个错误即将出现。
org.json.JSONException: JSONObject["weather"] not a string.
at org.json.JSONObject.getString(JSONObject.java:639)
at GetWeather.main(GetWeather.java:49)
这是我的代码
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
i
这是给我带来问题的函数:
public String URLToJson() {
String result = "";
String jsonString = ReadingURL(" here goes my URL that reads a JSON ");
JSONObject jsonResult = null;
try {
jsonResult = new JSONObject(jsonString);
JSONArray data = jsonResult.getJSONArr
我想解析一个json文件,下面是我的代码:
import org.json.JSONArray;
import org.json.JSONObject;
public class principale {
public static void main(String[] args) {
// TODO Auto-generated method stub
String fichier ="C:\\listesanscoord.json";
JSONObject obj = new JSONObject("fi
我编写了以下代码来确定用户输入的数据类型。
Update:删除对Float的解析,因为Double值也可以解析为Float,而代价是一定的精度,如@DodgyCodeException所述。
import java.util.Scanner;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class Main {
public static void main(String[] args) {
Scanner src = new
我正在试着用牛津的API编写一本英语词典。我根据网上找到的文档和资源做了这件事。但是我得到了这个问题,"org.json.JSONException: No value for senses",我不知道为什么。无论我往哪里看,我都找不到这个问题的原因。我会给你我的MainActivity和request class。有谁可以帮我? MainActiviy: package com.alitalhacoban.english_dictionary;
import android.os.Bundle;
import android.view.View;
import androi
我有一个包含一些数据的json文件,我试图使用modal类将这些数据解析成数组中的kotlin,并在回收器视图中显示,但无法获得它,我共享代码和jsonfile。 MainActivity `class MainActivity : AppCompatActivity() {
private val Base_url = "http://192.168.43.163:3000/Users"
lateinit var progressBar: ProgressBar
lateinit var recyclerView: RecyclerView
lateinit var r