问题标签 [json-simple]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 使用 simple-json 解析 json 字符串
我已经阅读了似乎与我的问题相同的帖子,但我一定遗漏了一些东西。我的环境是 Eclipse Mars。我的 JAVA 是 1.7,我已经导入了 json-simple。我只是想解析从我的网络服务返回的 json。如果我需要修改其输出,我将控制 Web 服务。我在下面看到了 json,arg[0]
但是 Object obj 是 null,因为当然是JSONArray
数组。我知道我缺少一些基本的东西,但我很难过,有点累。
这是返回的json:
这是使用 json-simple 的解析代码:
java - 解析多个相同键的 JSON 简单 java
我不是 JSON 方面的专家,所以我不确定我是否明显遗漏了一些东西。但是,我想做的是解析这个:
我不想只得到 Djinnibone 后面的其他名字。我设法创造的是这个。它给出了正确数量的名称。但它们都是空的。在这种情况下 null,null,null,null 。
谢谢你的帮助!
android - Android中使用json简单的JSON解析问题
由于我在使用 Android 的 JSON(即 org.json)时遇到了一些问题,所以这里我使用的是json simple。但是当我尝试使用 json 解析器将字符串转换为 json 对象时,例如,
发生错误:
请提出一种方法。提前致谢。
java - 错误:不能从静态上下文引用非静态方法 get(Object)
下面的代码显示:
任何人都知道为什么会这样?
(顺便说一句,这段代码是在网上找到的,我编辑了它以测试运行,这样我就可以创建一个新代码来接收不同类型的 txt 文件。)
项目:来自 StackOverflow 页面的代码How to read json file into java with simple JSON library
java - JSON in Java : Using encoded JSON files and keeping it
Im using json-simple to read from JSON files, to alter the attributes inside and to write them back to a file. This a line:
Problem: I get this as a Map when I load them to a JSONObject:
I want to keep the coding "M\u00e4nnlich2" and the url shouldnt get escapes.
Is this normal? How can i keep the encoding when I parse it into a JSONObject? Or should I use a different JSON library?
Here is some Example code:
java - 如何在 Java 中使用 json-simple 解析 JSON 部分?
我目前正在使用 Twitch API 来获取有关直播的信息。但是,我似乎无法在流部分下为观众等获取数据。我使用 json-simple 作为 maven 依赖项。
java - 使用 json-simple 解析嵌套的 JSON 数组
尝试使用 json simple 来解析来自 rest 服务的数据。响应如下所示:
我的问题是我无法从 JSONArray 对象中获取对作业元素的引用。“位置”引用是基本解析,但“工作”引用在数组中定义时给了我问题。
getJSONObject 似乎也不是 JSONArray 的有效方法。
这可以用 json-simple 库来完成吗?
java - json-simple 与 jackson 在没有 obj 类型时解析 json
要使用杰克逊 API 将 json 字符串转换为 pojo,可以使用:
这需要创建与 json String 的结构匹配的类 User。
使用 json-simple API 可以改用:
使用 json-simple 不需要包含匹配 json 格式的 pojo。可以在杰克逊中使用类似的吗?json-simple 不那么冗长,因为不必创建匹配 json 结构的类。
java - How to get names of objects within object? (JSON)
I am trying to figure out (using json-simple) how to get the name of an object within an object. For example:
I would like to get the value obj1
and obj2
(as they're the names of the objects, which is what I want). How would I do this with JSON-Simple and Java and put them into a String[]?
java - JSONArray 到 ArrayList
是否可以使用json-simple(并且没有其他附加库)将 a 转换为JSONArray
a ArrayList<MyObject>
?
我无法在文档中或 SO 上找到代码示例。
这就是我目前的做法(相当复杂):
我的“POJO”: