JSON文件到CSV或Oracle表

时间:2015-09-14 12:31:25

标签: json xml oracle

我必须在CSV文件中转换JSON文件,甚至更好,将JSON文件内容解压缩到Oracle表中。

我查看了其他主题,我发现的唯一一个与HTML表格中的转换有关。

这些文件实际上是非结构化的,这里有一个例子:

        {
          "message-version" : "1.2",
          "orcid-profile" : {
            "orcid" : null,
            "orcid-id" : null,
            "orcid-identifier" : {
              "value" : null,
              "uri" : "http://orcid.org/0000-0002-3285-9536",
              "path" : "0000-0002-3285-9536",
              "host" : "orcid.org"
            },
            "orcid-deprecated" : null,
            "orcid-preferences" : {
              "locale" : "EN"
            },
            "orcid-history" : {
              "creation-method" : "MEMBER_REFERRED",
              "completion-date" : null,
              "submission-date" : {
                "value" : 1417193651961
              },
              "last-modified-date" : {
                "value" : 1418131422749
              },
              "claimed" : {
                "value" : true
              },
              "source" : null,
              "deactivation-date" : null,
              "verified-email" : {
                "value" : true
              },
              "verified-primary-email" : {
                "value" : true
              },
              "visibility" : null
            },
            "orcid-bio" : {
              "personal-details" : {
                "given-names" : {
                  "value" : "Marcin"
                },
                "family-name" : {
                  "value" : "Serocki"
                },
                "credit-name" : null,
                "other-names" : null
              },
              "biography" : null,
              "researcher-urls" : null,
              "contact-details" : null,
              "keywords" : null,
              "external-identifiers" : null,
              "delegation" : null,
              "applications" : null,
              "scope" : null
            },
            "orcid-activities" : {
              "affiliations" : {
                "affiliation" : [ {
                  "type" : "EDUCATION",
                  "department-name" : "Department of Pharmaceutical Technology and Biochemistry",
                  "role-title" : "PhD",
                  "start-date" : {
                    "year" : {
                      "value" : "2010"
                    },
                    "month" : {
                      "value" : "09"
                    },
                    "day" : {
                      "value" : "01"
                    }
                  },
                  "end-date" : null,
                  "organization" : {
                    "name" : "Gdansk University of Technology",
                    "address" : {
                      "city" : "Gdansk",
                      "region" : null,
                      "country" : "PL"
                    },
                    "disambiguated-organization" : null
                  },
                  "source" : {
                    "source-orcid" : {
                      "value" : null,
                      "uri" : "http://orcid.org/0000-0002-3285-9536",
                      "path" : "0000-0002-3285-9536",
                      "host" : "orcid.org"
                    },
                    "source-client-id" : null,
                    "source-name" : {
                      "value" : "Marcin Serocki"
                    },
                    "source-date" : {
                      "value" : 1418131402196
                    }
                  },
                  "created-date" : {
                    "value" : 1418131402196
                  },
                  "last-modified-date" : {
                    "value" : 1418131402196
                  },
                  "visibility" : "PUBLIC",
                  "put-code" : "611828"
                }, {
                  "type" : "EDUCATION",
                  "department-name" : "Department of Pharmaceutical Technology and Biochemistry",
                  "role-title" : "MSc",
                  "start-date" : {
                    "year" : {
                      "value" : "2005"
                    },
                    "month" : {
                      "value" : "09"
                    },
                    "day" : {
                      "value" : "01"
                    }
                  },
                  "end-date" : {
                    "year" : {
                      "value" : "2010"
                    },
                    "month" : {
                      "value" : "07"
                    },
                    "day" : {
                      "value" : "01"
                    }
                  },
                  "organization" : {
                    "name" : "Gdansk University of Technology",
                    "address" : {
                      "city" : "Gdansk",
                      "region" : null,
                      "country" : "PL"
                    },
                    "disambiguated-organization" : null
                  },
                  "source" : {
                    "source-orcid" : {
                      "value" : null,
                      "uri" : "http://orcid.org/0000-0002-3285-9536",
                      "path" : "0000-0002-3285-9536",
                      "host" : "orcid.org"
                    },
                    "source-client-id" : null,
                    "source-name" : {
                      "value" : "Marcin Serocki"
                    },
                    "source-date" : {
                      "value" : 1418131329327
                    }
      },
      "created-date" : {
        "value" : 1418131329327
      },
      "last-modified-date" : {
        "value" : 1418131329327
      },
      "visibility" : "PUBLIC",
      "put-code" : "611826"
    } ]
  },
  "orcid-works" : null,
  "funding-list" : null
},
"orcid-internal" : null,
"type" : "USER",
"group-type" : null,
"client-type" : null
   },
   "orcid-search-results" : null,
   "error-desc" : null
 }

我不知道该怎么办?

1 个答案:

答案 0 :(得分:-1)

所有代码都可以在github上找到。 代码根据2013年csv中的更改进行更新,此后CSV现在有标题!该字段的密钥名称现在是CSV的第一行。

https://github.com/vinay20045/json-to-csv

OR

您可以使用api

https://json-csv.com/api转换。

只需在那里注册获取api可访问权限并使用其代码。那是