【问题标题】:Parse application/ld+json in java/android studio在 java/android studio 中解析 application/ld+json
【发布时间】:2021-11-07 23:54:15
【问题描述】:

我正在尝试从here 访问“datePublished”。它在源代码中可见:

            <script type="application/ld+json">


{
    "@context": "https://schema.org",
    "@type": "NewsArticle",
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "https://www.minecraft.net/en-us/article/minecraft-java-edition-1-17-1"
    },
    "headline": "Article headline",
    "image": [
        "https://www.minecraft.net/content/dam/games/minecraft/screenshots/1-17-1-release-header.jpg"
    ],
    "datePublished": "2021-07-06T13:42:49.957+0000",
    "author": {
        "@type": "Person",
        "name": "Adrian Östergård"
    },
    "publisher": {
        "@type": "Organization",
        "name": "Minecraft",
        "logo": {
            "@type": "ImageObject",
            "url": "https://www.minecraft.net/etc.clientlibs/minecraft/clientlibs/main/resources/img/header/logo.png"
        }
    }
}</script>

我尝试使用 url 来字符串解析器,然后提取 json,但该元素没有显示在日志中。 非常感谢

【问题讨论】:

  • 欢迎来到 Stack Overflow。请通过tour 了解 Stack Overflow 的工作原理,并阅读How to Ask 以了解如何提高问题的质量。请显示您尝试过的尝试以及您从尝试中得到的问题/错误消息。

标签: java android html json json-ld


【解决方案1】:

编辑:在控制台日志上启用了正则表达式,所以日期没有出现...... 猜猜谁浪费了大约 12 小时的生命:')

【讨论】:

    猜你喜欢
    • 2015-11-11
    • 2015-07-23
    • 2016-04-01
    • 2015-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多