我有一个结构如下的 json 对象:
{
"catNames" : ["a1", "a2", "a3", "a4"],
"dogNames" : ["b1", "b2", "b3", "b4"],
"goldfishNames" : ["c1", "c2", "c3", "c4"]
}
我想做的是解析这个对象并将输入字符串与 , "catNames","dogNames"进行比较"goldfishNames",如果两者匹配,比方说catNames,我想从catNames数组中打印一个随机元素。我完全迷失了,我该怎么办?
守着一只汪
慕雪6442864
随时随地看视频慕课网APP
相关分类