在阅读 Json Lines 之前描述正确的模式类型

问题描述

我有一个 JSonl 文件,在将其验证为架构文件后,我可以通过我的 C# 代码读取这些文件。我从一个简单的文件开始,我的架构为下面提到的 json 文件定义了这样的东西

我能够读取的 Json 数据:

{"PartitionKey": "test","RowKey": "7tttt","Ape": 653,"Nepe": "depe","EPA": 323,"Time": "04/23/2012 18:25:43","bits": "test"}
{"PartitionKey": "test","RowKey": "itttt","Ape": 432,"Nepe": "TNepe","EPA": 23,"Time": "04/22/2012 18:25:43","bits": "Ttest"}
{"PartitionKey": "test","RowKey": "ktttt","Ape": 323,"Nepe": "HNepe","EPA": 34,"Time": "04/20/2020 18:25:43","bits": "Jtest"}

我用来验证的架构是这样定义的:

{
    "$schema": "http://json-schema.org/draft-04/schema#","type": "object","properties": {
      "PartitionKey": {
        "type": "string"
      },"RowKey": {
        "type": "string"
      },"Ape": {
        "type": "integer"
      },"Nepe": {
        "type": "string"
      },"EPA": {
        "type": "number"
      },"Time": {
        "type": "string"
      },"bits": {
        "type": "string"
      }
    },"required": [
      "PartitionKey","RowKey","Ape","Nepe","EPA","Time","bits"
    ]
  }

现在上面的工作正常并且在阅读之前可以很好地验证。但是现在我有一些复杂的 JSON 需要阅读,我正在尝试为下面这个复杂的 Json 定义模式。所以我请求帮助设计而不是更正我下面的 JSON 的模式:

{
"PartitionKey": "te123","RowKey": "zz","Version":"123","Eest":{"Bulls":1848,"Message":"Passed (0.325 mA < 2[0] => 'P')","Credit":0.325,"Read":0.14,"SBin":"P"},"GenericTests":[],"HostVersion":"Test","RawSampleIDData":[1,3,2,4]
}

我为上面设计的架构:

{
    "$schema": "http://json-schema.org/draft-04/schema#","Version": {
        "type": "string"
      },"Est": {
      "Bulls": "number","Message": "string","Credit": "number"
      "Read": "number","SBin":"string"        
      },"GenericTests": {
        "type": "string"
      },"HostVersion": {
        "type": "string"
      },"RawSampleIDData": {
        "type": "string"
      }
    },"Version","Est","GenericTests","HostVersion","RawSampleIDData"      
    ]
  }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)