0
说我有喜欢解析“复杂”与JSON猪
{
"revenue": 100,
"products":[
{"name": "Apple", "price": 50},
{"name": "Banana", "price": 50}
]
}
显然,这本有点做作一些比较复杂的JSON,但有什么用JsonLoader此地图猪的最佳途径。
我已经试过
a = LOAD 'test.json' USING
JsonLoader('revenue:int,products:[(name:chararray,price:int)]');
或
a = LOAD 'test.json' USING
JsonLoader('revenue:int,products:[{(name:chararray,price:int)]}');
然而,当我DUMP A
,我得到(100,)
两种。
我也试过
a = LOAD '/json/complex.json'
USING JsonLoader('revenue:int,products:[{name:chararray,price:int}]');
哪些错误出与ERROR 1200: <line 1, column 28> mismatched input 'chararray' expecting LEFT_PAREN
。
什么是解析这个以供将来使用的最佳方法?
感谢