简体   繁体   English

使用JACKSON解析python dicts

[英]Parsing python dicts with JACKSON

I would like to parse python dicts. 我想解析python dicts。 There are 2 differences between json and python dicts: json和python dicts之间有2个不同之处:

  • python dicts allow simple quotte (easy to do with jackson using jsonParser.Feature.ALLOW_SINGLE_QUOTES). python dicts允许简单的引用(使用jsonParser.Feature.ALLOW_SINGLE_QUOTES很容易使用jackson)。
  • for booleans, python dicts have "True" and "False" instead of "true" and "false". 对于布尔值,python dicts有“True”和“False”而不是“true”和“false”。

Do you know if how to be case insensitive on "True" and "False" with jackson ? 你知道杰克逊如何对“真”和“假”不区分大小写吗?

Thanks a lot for your help, it is blocking for me. 非常感谢你的帮助,这对我来说是阻碍的。

Best regards, 最好的祝福,

Jérôme Odier JérômeOdier

My code: 我的代码:

private static final ObjectMapper m_objectMapper = new ObjectMapper(
    new JsonFactory().enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES)
);

There is a github issue for this problem in Jackson project 杰克逊项目中存在这个问题的github问题
https://github.com/FasterXML/jackson-databind/issues/1852 https://github.com/FasterXML/jackson-databind/issues/1852

There is also a Pull Request for the issue which you can make use of 对于您可以使用的问题,还有一个Pull Request
https://github.com/FasterXML/jackson-databind/pull/2132 https://github.com/FasterXML/jackson-databind/pull/2132

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM