擅长:python、mysql、java
<p>固定的。山药很烂,所以不要用它。所有的yamsnal和yamsnal都不是从所有类型的yamsnal中派生出来的,但是什么样的yamsnal显然是从所有的yamsnal格式中派生出来的。在</p>
<p>而且,YAML的性能很差,JSON更简单、更容易实现。在我们的中间件所在的Python中(大多数处理都会发生),YAML的处理时间几乎是JSON的两倍!!在</p>
<p>如果您使用的是python2.6或更高版本,只需</p>
<pre><code> import json
json_doc = json.dumps(projects, default=convert_to_builtin_type)
print json_doc
def convert_to_builtin_type(obj):
print 'default(', repr(obj), ')'
# Convert objects to a dictionary of their representation
d = { '__class__':obj.__class__.__name__,
'__module__':obj.__module__,
}
d.update(obj.__dict__)
return d
</code></pre>
<p>然后在Java客户端(加载)端,使用GSon这需要花费大量的脑力劳动和搜索才能弄清楚,因为网络上的所有示例实际上都是无用的。每页有500个广告的博主都会向你展示如何转换一个单一的、愚蠢的对象。上次我创建一个应用程序时,我使用了列表、数组或任何包含多个对象的东西!!在</p>
^{pr2}$
<hr/>
<p>完成了!简而言之,YAML很烂,而且使用JSON!!另外,http连接代码大部分是从这个网站剪下来的…现在我需要弄清楚https。在</p>