Caching a JSON object in Worker through Cache API

Is it possible to cache JSON object in the service worker using Workers Cache API?

I tried cache.put method and according to the documentation with request as a String.
So according to the Cache API documentation on cache.put “Each method accepts a Request object or string value as its first parameter. If a string is passed, it will be interpreted as the URL for a new Request object” and I am making a response as

myResponse = new Response(myJSONObject,{"status" : 200 ,"headers":{"Cache-Control" : "max-age=10000" } })
cache.put("myObject", myResponse)

And I am trying to match the cache using this call.
let getCachedResponse = await cache.match("myObject",{ignoreMethod : true});

But I am unable to get this to work. Can somebody show any example if its possible to cache a JSON object through Cache API.

What does that exactly mean?

Does put not work or match?

Not able to put anything with string as my request and even match fails for string entry.
Is it even possible to put cache with string and response as JSON object wrapped in Response ?

Url as request works for both put and match works perfectly.

If you pass a string it apparently should be a URL

Cache API it to cache HTTP Response where the key is your URL.

You could store your object within a global variable and run a similar logic below. This case stores a KV json in a global variable.

  if (plan.expiration === undefined || plan.expiration < Date.now()) {
    plan = {
      data: await NAMESPACE.get("json-plan", "json"),
      expiration: (await Date.now()) + value_ttl * 1000
    };
  }