jmespath / jmespath.py

JMESPath is a query language for JSON.

Home Page:http://jmespath.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can jmespath support parse json-key with chinese like the next example

pandatools opened this issue · comments

import jmespath
data = {"姓名": "张三", "年龄": 18, "性别": "男"}
query = '姓名'
result = jmespath.search(query, data)

Yes, you'll need to surround the key name in double quotes (i.e a quoted identifier):

import jmespath
data = {"姓名": "张三", "年龄": 18, "性别": "男"}
query = '"姓名"'
result = jmespath.search(query, data)
print(result)

prints:

张三