Based on Google’s documentation for Sitelinks Searchbox you need to start by creating a website data item for your homepage. From there you can use the potential action field to create a search action data item. You will want your website data item JSON-LD to look like this:


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

{

    "@context": "http://schema.org",

    "@type": "WebSite",

    "potentialAction": {

        "@type": "SearchAction",

        "target": "https://www.example.com/search?q={search_term_string}",

        "name": "Search Example Site",

        "query-input": "required name=search_term_string",

        "@id": "https://www.example.com/#SearchAction"

    },

    "url": "https://www.example.com/",

    "name": "Example Website",

    "@id": "https://www.example.com/#WebSite"

}

</script>


This is what your search action data item will look like in the editor:


To verify the work that you’ve done, use the view json-ld feature within the editor. Then copy the markup and input it as code into Google’s Rich Results Tool