问题描述:

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. git 提交到github时不用每次都输入用户名,密码

    Permanently authenticating with Git repositories, Run following command to enable credential caching ...

  2. 8.2 sikuli 集成进eclipse 报错:Getting the VisionProxy.dll: Can not find dependent libraries...

    如果在执行脚本的时候出现以下错误: Getting the VisionProxy.dll: Can not find dependent libraries... 把Sikuli X 的libs目录 ...

  3. OpenGL-------状态机

    状态机就是一种存在于理论中的机器,它具有以下的特点: 1. 它有记忆的能力,能够记住自己当前的状态. 2. 它可以接收输入,根据输入的内容和自己的状态,修改自己的状态,并且可以得到输出. 3. 当它进 ...

  4. opencv-----基本数据类型

    OpenCV提供了多种基本数据类型.可以在"…/OpenCV/cxcore/include"目录下的cxtypes.h文件中查看其详细定义. CvPoint是一个包含integer ...

  5. Spring Boot 系列教程12-EasyPoi导出Excel下载

    Java操作excel框架 Java Excel俗称jxl,可以读取Excel文件的内容.创建新的Excel文件.更新已经存在的Excel文件,现在基本没有更新了 http://jxl.sourcef ...

  6. tiny210 u-boot 网络ping不通主机解决方案

    站在巨人的肩膀上: http://blog.csdn.net/liukun321/article/details/7438880 http://www.arm9home.net/read.php?ti ...

  7. 网络获取数据的Xml的Pull解析

    网络获取的XML的Pull解析 <?xml version="1.0" encoding="utf-8" ?> - <students> ...

  8. windows程序设计学习笔记(一)

    windows里的变量类型 1.简单重定义windows变量 BOOL (TRUE FALSE) INT UINT(32位,4字节) LONG DWORD(32位,4字节) lParam,wParam ...

  9. UAC绕过思路(未完)

    ---恢复内容开始--- What is UAC?

  10. Android----ListView入门知识--各种Adapter配合使用

    引自:http://www.cnblogs.com/playing/archive/2011/03/21/1990555.html 在android开发中ListView是比较常用的组件,它以列表的形 ...