这是什么样的对象?

时间:2013-05-20 19:10:14

标签: php python json object format

我正在尝试在python或PHP中加载此对象,但我现在正在尝试知道是否有已编写的库,以便我自己不解析文档。

variable = [["1","arbitrary string","another arbitrary string"],
["2","arbitrary string","another arbitrary string"],
["3","arbitrary string","another arbitrary string"],
["4","arbitrary string","another arbitrary string"]];
another_variable = "arbitrary string";

任何提示都将不胜感激。 感谢

2 个答案:

答案 0 :(得分:0)

这看起来很像JSON。 PHP有一些内置函数来处理它 - 例如:json_decode:http://www.php.net/manual/en/function.json-decode.php

看起来Python也有一个内置的JSON库:http://docs.python.org/3/library/json.html(如果你还在使用“旧”版本,那么Python 2中也可以使用相同的库。)

答案 1 :(得分:0)

这是一个JSON编码的字符串,表示一个数组数组。

您可以使用以下命令将其设为PHP原生元素:

$var = json_decode($variable);

请注意json_decode()仅在5.2之后内置于PHP。否则你必须从PEAR获得它。