nim json操作示例代码

代码语言:nim

所属分类:文件

代码描述:nim json操作示例代码

代码标签: 示例

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

import json

let element = "Hydrogen"
let atomicNumber = 1

let jsonObject = %* {"element": element, "atomicNumber": atomicNumber}
# This will print {"element":"Hydrogen", "atomicNumber": 1}
echo $jsonObject


# We start with a string representation of a JSON object
let jsonObject2 = """{"name": "Sky", "age": 32}"""
let jsonArray = """[7, 8, 9]"""

let parsedObject = parseJson(jsonObject2)
let name = parsed.........完整代码请登录后点击上方下载按钮下载查看

网友评论0