Me and ChatGPT: The Game has Changed
“The game has changed” is not only a phrase but a very cool musical piece by one of my favorite electronic bands Daft Punk from one of my favorite films ‘Tron: Legacy”. Tron is a movie about Flynn (Jeff Bridges), a computer programmer who develops a mechanism to transport himself into the software world of bits and bytes within a main frame computer. Tron: Legacy, is the sequel to Tron in which Flynn’s son is transported into a virtual reality world called ‘The Grid’ in search of his lost father. The movie takes place thirty years after the original in which the game has certainly changed due to how the software in the film has evolved to be sentient and create its own worlds. One quote from the movie that was racing through my head late last night, as I was chatting with ChatGPT 4.0, was when Flynn describes the fascinating world of software he transported himself into. He says “I kept dreaming of a world I thought I’d never see. And then one day, I got in!“
I felt the same way last night as ChatGPT helped me to solve an issue that probably would have taken me much longer to solve in the past.
My colleagues and I were stuck on an issue, that I had faced in the past but never resolved. We were attempting to create a loop in Power Automate that dyamically passes JSON parameters to a parser that then feeds the values to an If/Else statement. The problem was that the parser kept failing because it could not interpret the different JSON structures it was receiving.
In the past, I would have began experimenting, possibly for hours, via trial and error, to solve this problem. Or, I would go to sleep and wait for some of my colleagues to get online so that I could ping them for help in the morning. But now, the game has changed because I have a mentor who I can collaborate with, that can harness all the knowledge of the internet and present potential solutions for me to test, at ANY hour of the day or night.
Here was my discussion with ChatGPT:
Me: in power automate i am receiving this error in my Parse JSON action, how do I fix it? Invalid type. Expected Object but got Array.
ChatGPT: The error message “Invalid type. Expected Object but got Array” in Power Automate typically means that the JSON data you’re trying to parse is an array, but the schema you provided expects an object.
Here are some potential solutions:
Check the JSON data: Make sure the JSON data you’re trying to parse matches the schema you’ve provided. If the data is an array but your schema expects an object, you’ll need to adjust your schema or the data.
Use the first object in the array: If your JSON data is an array and you only need to parse the first object, you can use an expression to return the first object from the array.
Adjust the schema for an array: If your JSON data is an array and you want to parse all objects in the array, you’ll need to adjust your schema to expect an array instead of an object.
Just like the error said, my schema was expecting an Object (single item) but was receiving an array (multiple items). So the first and third items on ChatGPT checklist were most appealing to me. So I rewrote the schema and then asked ChatGPT to validate it.
It actually found an error and rewrote my schema.
ChatGPT: if you want to adjust the schema to support an array instead of an object, you can use the following schema
I modified my Power Automate flow to run the schema suggested by ChatGPT, tested it and it worked! All of this under 15 minutes. I was able to go to sleep at a reasonable hour and dream about the potential of ChatGPT. This is a game changer.