简体   繁体   English

如何从此json字符串中获取所有名称

[英]how to fetch all names from this json string

Can anyone help me to fetch the names from the json string谁能帮我从 json 字符串中获取名称

FileDatas[] respone = new Gson().fromJson(outputTemplate, FileDatas[].class);
for (FileDatas s : respone) {
    template_name = s.getName();
    System.out.println("Template Name : "+template_name);
    templateName.addItem(template_name);
}

答案是变量名 longName 在 pojo 类中应该与变量完全相同,例如,如果我想从 json 字符串中获取数据 longName 那么在 pojo 类中我会将变量初始化为私有 String longName 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从json中提取所有变量名? - How to extract all variable names from json? 从Java中的文本字符串中获取所有有效的JSON字符串 - Fetch all the valid JSON strings from a text String in Java Java - 如何从 JSON 架构中获取所有字段名称 - Java - How to get all the field names from JSON Schema 如何从JSON响应中获取所有属性名称(是否嵌套) - How to get all attributes names(nested or not) in from JSON response 如何从解析的字符串(Json 请求)中获取参数值 - How to fetch a parameter value from parsed String (Json Request) 无法从服务器获取所有json响应 - Not able to fetch all json response from server 如何获取 Firestore 集合中所有文档的名称(一个字段)? - How to fetch the names (a field) of all the documents in a Firestore collection? java - 如何从Java中的JSON对象获取从父节点到子节点的所有节点? - How to fetch all nodes from parent to child from JSON Object in java? Android-如何从字符串资源中获取名称中包含两个或多个相似单词的所有元素 - Android - How to get from string resources all the elements which contains two or more similar words on their names 如何使用 spring jpa 编写查询以从数据库中获取与我们传递的字符串匹配的所有行? - How to write a query using spring jpa to fetch all rows from a database that are matching the string we pass?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM