这是什么样的记号? [英] What kind of notation is this?
本文介绍了这是什么样的记号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个看起来像这样的字符串:
I've a string which looks like this:
[{
text: "key 1",
value: "value 1"
}, {
text: "key 2",
value: "value 2"
}, {
text: "key 3",
value: "value 3"
}]
我不确定这是什么符号,AFAIK是由ASP .NET后端生成的.它看起来与JSON非常相似,但是对此调用json_decode()失败.
I'm not sure what kind of notation this is, AFAIK this is generated by a ASP .NET backend. It looks a lot similar to JSON but calling json_decode() on this fails.
有人可以为我介绍一下这种表示法,并为我提供一种有效的方法来使用PHP将其解析为键/值数组吗?
Can someone bring me some light on this kind of notation and provide me a efficient way to parse it into a key / value array with PHP?
推荐答案
可以通过任何方式更改输出吗?引用密钥名称似乎可以使其正常解析:
Any way you can change the output? Quoting the key names seems to allow it to parse normally:
$test = '[{"text":"key 1","value":"value 1"},{"text":"key 2","value":"value 2"},{"text":"key 3","value":"value 3"}]';
var_dump(json_decode($test));
这篇关于这是什么样的记号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文