Creating JSON data with shortcuts

i have created a Shortcut to create a JSON data set but every time i invoke the shortcut after the first time it gives me a response that says it can produce a data because that shortcut couldn’t convert dictionary to text.
IF the shortcut is not good please feel free to contribute
This is the shortcut

I did a few quick tests. It is the final step of appending to file that is causing the issue. It looks to be because Shortcuts is doing some sort of checking to ensure that you are saving valid JSON - you are not. If you change the file to be a TXT file rather than a JSON file, it seems to work well.

If you do want to use JSON, you can’t just keep appending as you will end up with invalid JSON. JSON shouldn’t end with a comma, there should be curly braces delimiting the data, etc,

Put a quick look on the Dictionary in the shortcut. What it shows you is valid JSON. Note the start and end, and all the comma separated key value pairs. That’s what a valid JSON file would also conform to.

If you want to add JSON elements, e.g. have your JSON file containing JSON with a key for each date, with each date then having a JSON structure of the data, that would be possible, but you need to update the file, not just append to it. If you are not interested in it being a true JSON file, just change the file extension.

As an aside I think your Current Date and date in a text field are also redundant. The dictionary can access the always available Current Date variable to set the date, and the latter seemed to be never used. That should streamline things a bit further.

Hope that helps.

Test