问题描述:

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. Simple But Useful Samples About 'grep' Command(简单实用的grep 命令)

    Do the following: grep -rnw '/path/to/somewhere/' -e "pattern" -r or -R is recursive, -n i ...

  2. ReactiveCocoa 浅析

    转载自:http://limboy.me/ios/2013/12/27/reactivecocoa-2.html   ReactiveCocoa是Github开源的一款cocoa FRP 框架,我在之 ...

  3. UICollectionView 浅析

    什么是UICollectionView UICollectionView是一种新的数据展示方式,简单来说可以把他理解成多列的UITableView(请一定注意这是UICollectionView的最最 ...

  4. push以及pop,shift,unshift

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

  5. css 7.30

    1.外提到内联元素,我们会想到有个display的属性是display:inline;这个属性能够修复著名的IE双倍浮动边界(float时margin)问题 2.一般来说,可以为所有块级元素应用 te ...

  6. sql 指定范围 获取随机数

    DECLARE @nMinimumCount INT= 1DECLARE @nMaximumCount INT= 100SELECT abs(CHECKSUM(NEWID()))%(@nMaximum ...

  7. android 垂直 SeekBar 源代码(VerticalSeekBar)[转]

    主要是继承 AbsSeekBar 然后修改下面这些方法 onProgressRefresh() //当进度条数据更新的时候,例如我们拖动滑动条的时候,这个方法被调用 setThumbPos() //这 ...

  8. Java程序员的10道XML面试题 (转)

    包括web开发人员的Java面试在内的各种面试中,XML面试题在各种编程工作的面试中很常见.XML是一种成熟的技术,经常作为从一个平台到其他平台传输数据的标准.XML面试问题包括用于转换XML文件的X ...

  9. android代码实现免提功能

    初始化AudioManager: private static AudioManager audioManager; 实现免提功能方法 protected void setSpeekModle() { ...

  10. CodeForces 678C Joty and Chocolate

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> ...