Closed. This question needs to be more focused. It is not currently accepting answers. Learn more。
想改进这个问题吗?更新问题,使其只关注一个问题editing this post。
三年前关闭。
我需要使用
想改进这个问题吗?更新问题,使其只关注一个问题editing this post。
三年前关闭。
我需要使用
json
创建包含此数据的c
文件。我该怎么做谢谢!{
"key" : "asdf",
"mapregister" :
{
"proxyMapReply" : true,
"eidToLocatorRecords" :
[
{
"authoritative" : true,
"prefixGeneric" :
{
"ipAddress" : "2.2.2.2",
"afi" : 1
},
"mapVersion" : 0,
"maskLength" : 32,
"action" : "NoAction",
"locators" :
[
{
"multicastPriority" : 1,
"locatorGeneric" :
{
"ipAddress" : "10.33.12.37",
"afi" : 1
},
"routed" : true,
"multicastWeight" : 0,
"rlocProbed" : false,
"localLocator" : false,
"priority" : 126,
"weight" : 1
} ,
{
"multicastPriority" : 1,
"locatorGeneric" :
{
"ipAddress" : "10.33.12.44",
"afi" : 1
},
"routed" : true,
"multicastWeight" : 0,
"rlocProbed" : false,
"localLocator" : false,
"priority" : 127,
"weight" : 1
}
],
"recordTtl" : 5
}
],
"keyId" : 0
}
}
最佳答案
您可以编写自己的逻辑来构建JSON文件和解析JSON文件。但我建议你也用第三方图书馆。
查看http://www.json.org/
它拥有所有基本的JSON文件,并在不同的编程列表中提供JSON解析器和creater可用的项目/工具列表。
对于c编程,我建议您使用https://github.com/json-c/json-c/wiki