Copy to clipboard JSON Custom Widget Inspect Table

Hello :smile:,
is it possible to copy to clipboard the result(JSON) of the “Custom Widget: Inspect Table”
instead of only columns of the table ?

Hi! It’s possible, for the most part. You need to create a column using a formula that contains the JSON for the record.

There is a handy function for this: RECORD(rec), which prepares a Python dictionary with all fields as keys. You can turn it into JSON using Python’s standard json.dumps, but it needs a little help to handle special values like references and attachments. The overall recipe for the formula is:

import json
json.dumps(RECORD(rec), default=lambda x: str(x))

Here is an example of it in-action: Copy Record JSON To Clipboard.

The format isn’t precisely the same as you would see in Inspect Table widget: in particular, the format of references, attachments is less helpful. Let me know if those are important – it’s possible to match that output more closely.

1 Like

Hey :smile:,
Thanks for the answer,
what I want is a list of json object, I tried with the summary table but the output is not like the “Inspect Table”
each element in the list is a string in my case with the formula

Try the formula

import json
json.dumps(RECORD($group), default=lambda x: str(x))

(if you don’t need the per-record JSON, you can remove the JSON column in the main table)

I added it to the example here: Copy Record JSON To Clipboard - Groups.

1 Like