Advanced
JSON Response Flag

The useJSON Flag

This flag is used in Bard.askAI() and Bard.Chat.ask().

Use this flag to get more information about the return request from Bard.

Return Structure

{
    "content": string,
    "images": [
        {
            "tag": string,
            "url": string,
        },
        ...
    ] | undefined,
    "ids": object
}

Let's walk through what each one of these properties is.

Property NameTypeDescription
contentstringThe Markdown return value of Bard
imagesobject | undefinedAn array of objects with tag and url properties. Will be undefined if no images.
images[idx].tagstringThe Markdown tag that is associated with the image.
images[idx].urlstringThe actual URL that leads to the images.
idsobjectAn object that is used to import/export conversations.

Usually it should not be necessary to use this flag, but it can be used for some certain scenarios, especially if you want to extend this library in some way.