小编Sai*_*aha的帖子

使用多线程加载大型 JSON 文件/

我正在尝试加载一个大的 3 GB JSON 文件。目前,使用 JQ 实用程序,我可以在近 40 分钟内加载整个文件。现在,我想知道如何在 JQ 中使用并行/多线程方法以在更短的时间内完成该过程。我正在使用 v1.5

使用的命令:

JQ.exe -r -s "map(.\"results\" | map({\"ID\": (((.\"body\"?.\"party\"?.\"xrefs\"?.\"xref\"//[] | map(select(ID))[]?.\"id\"?))//null), \"Name\": (((.\"body\"?.\"party\"?.\"general-info\"?.\"full-name\"?))//null)} | [(.\"ID\"//\"\"|tostring), (.\"Name\"//\"\"|tostring)])) | add[] | join(\"~\")" "\C:\InputFile.txt" >"\C:\OutputFile.txt"
Run Code Online (Sandbox Code Playgroud)

我的数据:

{
  "results": [
    {
      "_id": "0000001",
      "body": {
        "party": {
          "related-parties": {},
          "general-info": {
            "last-update-ts": "2011-02-14T08:21:51.000-05:00",
            "full-name": "Ibercaja Gestion SGIIC SAPensiones Nuevas Oportunidades",
            "status": "ACTIVE",
            "last-update-user": "TS42922",
            "create-date": "2011-02-14T08:21:51.000-05:00",
            "classifications": {
              "classification": [
                {
                  "code": "PENS"
                }
              ]
            }
          },
          "xrefs": {
            "xref": [
              {
                "type": …
Run Code Online (Sandbox Code Playgroud)

json jq

5
推荐指数
1
解决办法
1894
查看次数

标签 统计

jq ×1

json ×1