I'm manipulating few data with PHP, I have the choice between Json and XML. But I don't know what to choose, I never worked with one of them. So I want the easiest one.

Also I wonder if there's good classes that can make parsing (XML or Json) easier.

我主要关注易用性,而不是速度和规模.

推荐答案

json.org makes JSON parsing simple. SimpleXML makes XML simple for PHP.

When choosing which one, it really depends on your application. If you will be passing data to JavaScript for processing on the client-side, then I recommend JSON. IMO, XML is better for data interchange between systems because it is very well understood and human readable (making interpreting easier for you). JSON is smaller over the wire, as there are no closing tags.

Json相关问答推荐

将json数组反序列化为选项 struct

如何在Power BI中集成API和JSON数据后将数据转换为表?

从Razor Pages的AJAX Json呈现DataTables问题.Net GET

如何使用表键名称GROUP_BY

抓取低于w jolt的对象级别

在PowerShell中,如何获取数据对所在的JSON对象的名称

将PostgreSQL转换为JSON对象

PowerShell:使用JSON原生的Short命令处理JSON?

当由.sh脚本执行时,AWS查询字符串不会提取任何数据

判断 JSON 中的对象,而不是条件中提到的对象

如何使用 LINQ 在 C# 中重构对象?

如何使用 Serde 使用顶级数组反序列化 JSON?

未捕获的类型错误:无法读取 null 的属性props

Android 上的 JSON - 序列化

如何使用 Jackson 定义可选的 json 字段

Jackson Scala 模块的小例子?

JSON Schema:验证数字或空值

从调试器获取 IntelliJ Idea 中的 JSON 对象

有没有一种快速的方法可以在文本编辑器中将 JavaScript 对象转换为有效的 JSON?

log4j 支持 JSON 格式吗?