如何才能改进原始JSON数据才能使用它?

时间:2022-06-21 20:16:07

I'm trying to use some results exported in JSON of a script called "Mixed Content Scan" (it's a script in order to search on a website if there is some mixed HTTP/HTTPS content and if all your pages are ok in HTTPS).

我正在尝试使用一个名为“混合内容扫描”的脚本的JSON导出的一些结果(如果存在一些混合的HTTP / HTTPS内容,并且如果所有页面都在HTTPS中,那么它是一个在网站上搜索的脚本) 。

I'm a beginner with JSON, I read and watched a lot of tutorials in order to understand how to structure JSON data but I'm stumbling on something.

我是JSON的初学者,我阅读并观看了很多教程,以便了解如何构建JSON数据,但我磕磕绊绊。

Here is a sample of my data (first 3 lines) :

以下是我的数据示例(前3行):

{"message":"Scanning https://mywebsite.com/","context":[],"level":250,"level_name":"NOTICE","channel":"MCS","datetime":{"date":"2018-10-05 23:48:50.268196","timezone_type":3,"timezone":"America/New_York"},"extra":[]}
{"message":"00000 - https://mywebsite.com/","context":[],"level":400,"level_name":"ERROR","channel":"MCS","datetime":{"date":"2018-10-05 23:48:50.760948","timezone_type":3,"timezone":"America/New_York"},"extra":[]}
{"message":"http://mywebsite.com/wp-content/uploads/2015/03/image.jpg","context":[],"level":300,"level_name":"WARNING","channel":"MCS","datetime":{"date":"2018-10-05 23:48:50.761082","timezone_type":3,"timezone":"America/New_York"},"extra":[]}

I know I need to wrap my data around some {} or [] (tried both), but I think I'm missing something, for example, every JSON data validator websites are telling me that I have an error between 2 lines when I add a "," when I try to have multiple results into it.

我知道我需要将数据包装在某些{}或[](尝试过两者)中,但我认为我遗漏了一些东西,例如,每个JSON数据验证器网站都告诉我,当我在2行之间有错误时当我尝试将多个结果添加到其中时添加“,”。

How can I upgrade this raw data in order for a JSON validator to validate it?

如何升级此原始数据以使JSON验证程序对其进行验证?

Thanks!

1 个解决方案

#1


0  

How's this

[{
    "message": "Scanning https://mywebsite.com/",
    "context": [],
    "level": 250,
    "level_name": "NOTICE",
    "channel": "MCS",
    "datetime": {
        "date": "2018-10-05 23:48:50.268196",
        "timezone_type": 3,
        "timezone": "America/New_York"
    },
    "extra": []
}, {
    "message": "00000 - https://mywebsite.com/",
    "context": [],
    "level": 400,
    "level_name": "ERROR",
    "channel": "MCS",
    "datetime": {
        "date": "2018-10-05 23:48:50.760948",
        "timezone_type": 3,
        "timezone": "America/New_York"
    },
    "extra": []
}, {
    "message": "http://mywebsite.com/wp-content/uploads/2015/03/image.jpg",
    "context": [],
    "level": 300,
    "level_name": "WARNING",
    "channel": "MCS",
    "datetime": {
        "date": "2018-10-05 23:48:50.761082",
        "timezone_type": 3,
        "timezone": "America/New_York"
    },
    "extra": []
}]

Entries in an array need to be separated by commas.

数组中的条目需要用逗号分隔。

#1


0  

How's this

[{
    "message": "Scanning https://mywebsite.com/",
    "context": [],
    "level": 250,
    "level_name": "NOTICE",
    "channel": "MCS",
    "datetime": {
        "date": "2018-10-05 23:48:50.268196",
        "timezone_type": 3,
        "timezone": "America/New_York"
    },
    "extra": []
}, {
    "message": "00000 - https://mywebsite.com/",
    "context": [],
    "level": 400,
    "level_name": "ERROR",
    "channel": "MCS",
    "datetime": {
        "date": "2018-10-05 23:48:50.760948",
        "timezone_type": 3,
        "timezone": "America/New_York"
    },
    "extra": []
}, {
    "message": "http://mywebsite.com/wp-content/uploads/2015/03/image.jpg",
    "context": [],
    "level": 300,
    "level_name": "WARNING",
    "channel": "MCS",
    "datetime": {
        "date": "2018-10-05 23:48:50.761082",
        "timezone_type": 3,
        "timezone": "America/New_York"
    },
    "extra": []
}]

Entries in an array need to be separated by commas.

数组中的条目需要用逗号分隔。