-1

这是我要解析的 json 文件。我在一个文件夹中有一堆这样的文件,我需要将它们解析为表格格式。

    {
  "block-v1:SampleData-type@chapter+block@14a0423ddf4a4d90926fb348e86a6232": {
    "category": "chapter", 
    "children": [
      "block-v1:SampleData-type@sequential+block@0fd2ac771bd141f384b8a3c628207d1d", 
      //similar sequential blocks
    ], 
    "metadata": {
      "display_name": "XYZZ", 
      "start": "2017-02-13T07:00:00Z"
    }
  }, 
  "block-v1:SampleData-type@chapter+block@46a4c70e4ce94fa5b99b15138d656291": {
    "category": "chapter", 
    "children": [
      "block-v1:SampleData-type@sequential+block@98d28f78d0524360bd51ae57db438c0b"
    ], 
    "metadata": {
      "display_name": "QAQA", 
      "visible_to_staff_only": true
    }
  },
  "block-v1:SampleData-type@discussion+block@3214a8c65ced4efdaaff047ca4854111": {
    "category": "discussion", 
    "children": [], 
    "metadata": {
      "discussion_id": "3fb8fc6eb4f742e7567e8e488789d3132270c4f0", 
      "discussion_target": "MMMMM", 
      "display_name": "MMMMM"
    }
  }
  //similar more category blocks
  // start of all sequential blocks
  "block-v1:SampleData-type@sequential+block@0fd2ac771bd141f384b8a3c628207d1d": {
    "category": "sequential", 
    "children": [
      "block-v1:SampleData-type@vertical+block@aba5c5f4ea104d91bb74f6ce8504fb9d", 
      "block-v1:SampleData-type@vertical+block@973374916a1b4960bb04125906be5350"
    ], 
    "metadata": {
      "display_name": "XYZZ--QQQQ"
    }
  }, 
  // end of all sequential blocks
  // start of all vertical blocks
  "block-v1:SampleData-type@vertical+block@aba5c5f4ea104d91bb74f6ce8504fb9d": {
    "category": "vertical", 
    "children": [
      "block-v1:SampleData-type@video+block@f03bafe28e124a41bb6d86f921ec9d76"
    ], 
    "metadata": {
      "display_name": "XYZZ--QQQQ--AAAA"
    }
  }, 
  "block-v1:SampleData-type@vertical+block@973374916a1b4960bb04125906be5350": {
    "category": "vertical", 
    "children": [
      "block-v1:SampleData-type@html+block@4730907c48e947d1847be66944bbd30d"
    ], 
    "metadata": {
      "display_name": "XYZZ--QQQQ--BBBB"
    }
  }, 
  //end of all vertical blocks
  //
  //
  //
  //similar sequential and vertical blocks for other chapters
  //REMOVE COMMENTS WHILE TRYING TO PARSE THIS DATA
  //
  //
  }

需要得到以下输出:

以表格格式输出

我的问题是,这个带有唯一标识符的数据叫什么?而且,是否有现成的工具可以将这些数据解析为表格格式?或建议为此数据创建自定义解析器?

4

1 回答 1

0

有没有现成的工具可以将这些数据解析为表格格式?

是:jq https://stedolan.github.io/jq/

于 2018-03-31T09:17:54.260 回答