gpt4 book ai didi

jq - 文本拆分为多行时出现解析错误

转载 作者:行者123 更新时间:2023-12-02 03:31:54 25 4
gpt4 key购买 nike

当我将文本行拆分为多行并使用命令“jq .words.json”在屏幕上显示 JSON 文件时,我遇到了解析错误

单行文本值的 JSON 文件如下所示

{
"words" : "one two three four five"
}

命令“jq .words.json”工作正常并在屏幕上显示 JSON 文件。

但是当我将值“一二三四五”分成两行并运行相同的命令时我得到一个解析错误

{
"words" : "one two
three four five"
^
}

parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 3, column 20

解析错误指向第三行末尾的"。

我该如何解决这个问题?

蒂亚,安东尼

最佳答案

那是因为JSON格式不对。它应该看起来像这样:

{
"words" : "one two \nthree four five"
}

关于jq - 文本拆分为多行时出现解析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51628133/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com