how to include json-ld script in nuxt 3?

I am trying to add json-ld to my page, but still not working or not what I want.

Here is what I've tried so far:

  1. using useMeta()
useMeta({
    script: [
        {
            type: 'application/ld-json',
            json: jsonLd,
        },
    ],
});

result: <script type="application/ld-json" json="[object Object]"></script>

  1. using <Script> tag
<Script type="application/ld-json">
        {{ jsonLd }}
</Script>

result: <script type="application/ld+json"></script> empty value.

and

<Script type="application/ld-json" v-html="jsonLd"></Script>

result: <script type="application/ld-json" innerhtml="[object Object]"></script>

Am I missing something? Thanks.


Solution 1:

If in case anyone wondering, this is how I get it to work:

Using

<Script :children="jsonLd" />

Or

useMeta({
    script: [
        {
            type: 'application/ld-json',
            children: JSON.stringify(jsonLd),
        },
    ],
});