问题描述:

method_cfg["input_method"][0].asString()

报错误:

test1.cpp:40:46: error: ambiguous overload for ‘operator[]’ in ‘method_cfg.Json::Value::operator[](((const char*)"input_method"))[0]’

test1.cpp:40:46: note: candidates are:

/usr/include/json/value.h:277:14: note: Json::Value& Json::Value::operator[](Json::Value::UInt)

/usr/include/json/value.h:281:20: note: const Json::Value& Json::Value::operator[](Json::Value::UInt) const

/usr/include/json/value.h:294:14: note: Json::Value& Json::Value::operator[](const char*)

/usr/include/json/value.h:296:20: note: const Json::Value& Json::Value::operator[](const char*) const

/usr/include/json/value.h:298:14: note: Json::Value& Json::Value::operator[](const string&)

/usr/include/json/value.h:300:20: note: const Json::Value& Json::Value::operator[](const string&) const

原因和解答:

原因很简单,当是常量值0的时候,无法确定把它当作是 UINT 还是const char*,string来处理。

使用method_cfg["input_method"][0U].asString()或者使用变量 int n=0来代替

JSON的BUG的更多相关文章

  1. Ajaxfileupload 总结(包括插件处理json格式bug的解决方案)

    Ajaxfileupload 是一款轻量级js的上传插件,简单容易上手,今天简单学习了下. 1,引用jquery和Ajaxfileupload .js <script src="~/S ...

  2. json解析bug之ERROR ExceptionController:185 - not close json text, token : :

    错误:ERROR ExceptionController:185 - not close json text, token : : 原因:json数据格式有误.!我的错误是,缺少了一个包括json数据 ...

  3. PHP JSON的BUG

    将下面的数组进行 JSON 编码时出错,编码中丢掉了最后一维数组中的下标. Array ( [1] => Array ( [0] => Array ( [0] => Array ( ...

  4. 从 3.1 到 5.0 —— OpenReservation 更新记

    OpenReservation 从 asp.net core 3.1 到 5.0 Intro OpenReservation 是一个开源的预约系统,最初的版本是我们学校的活动室预约系统,现在正逐步变成 ...

  5. 一个粗心的Bug,JSON格式不规范导致AJAX错误

    一.事件回放  今天工作时碰到了一个奇怪的问题,这个问题很早很早以前也碰到过,不过没想到过这么久了竟然又栽在这里. 当时正在联调一个项目,由于后端没有提供数据接口,于是我直接本地建立了一个 json ...

  6. JSON金额解析BUG的解决过程

    [原创申明:文章为原创,欢迎非盈利性转载,但转载必须注明来源] 这是在我们开发的一个支付系统中暴露的一个BUG,问题本身比较简单,有意思的是解决问题的过程.将过程分享出来,希望能够对大家有所帮助. 一 ...

  7. json-lib-2.4.jar Bug,json字符串中value为"[value]"结构时,解析为数组,不会解析成字符串

    使用json-lib.jar 2.4进行json字符串转换为对象时发现一个bug.贴下测试代码: <dependency> <groupId>net.sf.json-lib&l ...

  8. ASP.NET Core 共享第三方依赖库部署的Bug(*.deps.json on 2.2.0 or 4.6.0 版本)

    背景: I try to put the Microsoft.*.dll and System.*.dll togather to a new folder.以便把(第三方或)系统的和应用的dll分开 ...

  9. 我的Android进阶之旅------>解决Jackson等第三方转换Json的开发包在开启混淆后转换的实体类数据都是null的bug

    1.错误描述 今天测试人员提了一个bug,说使用我们的app出现了闪退的bug,后来通过debug断点调试,发现我们的app转换服务器发送过来的json数据后,都是为null.而之前已经提测快一个月的 ...

随机推荐

  1. 【转】javascript Object使用Array的方法

    原文: http://www.cnblogs.com/idche/archive/2012/03/17/2403894.html Array.prototype.push push向数组尾部添加一项并 ...

  2. TCPIP header

    tcp packet: tcp header: ip header:

  3. gcc 优化选项 -O1 -O2 -O3 -Os 优先级,-fomit-frame-pointer

    英文:https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Optimize-Options.html#Optimize-Options 少优化->多优化: ...

  4. 留言本,keyCode

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...

  5. push以及pop,shift,unshift

    压入数组:往数组后面加:push         arr.push()返回值为添加后数组的长度 往数组前面加:unshift     arr.unshift()返回值为添加后数组的长度 拿出数组:拿掉 ...

  6. acm课程练习2--1013(同1014)

    题目描述 There is a strange lift.The lift can stop can at every floor as you want, and there is a number ...

  7. as3 公式

    AS3缓动公式:sprite.x += (targetX - sprite.x) * easing;//easing为缓动系数变量sprite.y += (targetY - sprite.y) * ...

  8. mouseleave 和 mouseout 区别

    jQuery中的mouseleave和mouseout的区别 $("li").each(function(i) {            //删除的鼠标划过的显示与隐藏       ...

  9. mysql笔记7之数据类型

    1 区别一: varchar:可变长度的字符串.根据添加的数据长度决定占用的字符数 char:固定长度的字符串 2区别二 int:没有限制 int(4):限制为4 3 区别三: 日期: date    ...

  10. 微信小程序Server端环境配置

    主要内容:1. SSL免费证书申请步骤2. Nginx HTTPS 配置3. TLS 1.2 升级过程 微信小程序要求使用 https 发送请求,那么Web服务器就要配置成支持 https,需要先申请 ...