我正在尝试解决偏航中的json数据,得到一个错误,这个错误无法识别问题。 Json数据是
{
"airport": [
{"airport": "MAA"},
{"city": "Chennai"},
{"country": "India"},
{"name": "Anna International Airport"}
]
}
我正在使用的命令是
{ok, Json, _} = rfc4627:decode(Arg#arg.clidata).
错误是
例外:undef Req: {http_request,' POST',{abs_path," /sample/rest.yaws"},{1,1}} Stack: [{rfc4627,解码 [<&#" {\ n \"机场\":[\ n {\"机场\":\" MAA \&#34 ;},\ n {\" city \":\" Chennai \"},\ n {\" country \": \" India \"},\ n {\" name \":\" Anna International Airport \"} \ n ] \ N}">&GT], []},
答案 0 :(得分:1)
您收到undef
个异常,表示您正在调用未定义的函数。错误显示堆栈,堆栈顶部是rfc4627:decode/1
函数;这是那个未定义的那个。
我的猜测是您的加载路径不包含您已存储已编译的rfc4627
模块的目录。您可以通过修改yaws.conf
文件并将以下内容添加到全局配置部分(靠近顶部),将该目录添加到Yaws加载路径:
ebin_dir = /path/to/where/rfc4627/is/stored
请注意,您可以拥有多个ebin_dir
设置;每个都被添加到加载路径。