KeyRoutines
StepFreedict.count

Count entries and list the keys in a dictionary

Count dictionary entries tells you how many named entries a dictionary has. It also gives you separate lists of the names and the values, which is handy for going through them one by one.

How it works

  • Pass a dictionary from an earlier step, or JSON text like {"name": "value"}.
  • It returns the count, a list of keys and a list of values.
  • Text that isn't a dictionary fails the step with a plain message.

Routines that use it

Loop over settings

Read a JSON file with Read JSON value, then repeat over the keys and apply each one.

Empty answer check

After an HTTP request, stop with Stop routine when the reply has no entries.

Show what's saved

Join the keys with Join list and show them in a banner.

Settings

SettingWhat it does
DictionaryThe dictionary.

Questions

How do I get all keys of a JSON object in KeyRoutines?
Use Count dictionary entries; its keys result is a list of every entry's name.
Can I count items in a JSON reply?
Yes. Pass the reply to this step for a dictionary, or to Count list items for a list.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.