Chat GPT was recently released and a lot has been talked about how impressive it is to interpret natural language and produce output. I decided to give it a try and the more I try it, the more impressed I get. Despite not being created specifically for coding, it can do many impressive things and become a great asset for automating some daily tasks if you get creative with your ideas. Here are some things you can do:
Convert JSON to data classes


In this conversation I asked to create a class from this JSON and it was able to create it as class Person (nice guess?) while using proper types and it even created the Car data class with a plausible set of attributes.
And of course, passing the data class we can get a sample JSON.
{"name":"John","age":30,"car":{"make":"Ford","model":"Mustang"}}The class generation part can potentially replace
RoboPOJOGeneratorplugin. ๐ฌ
Create Unit tests or mock data for it


As we can see, it generated a unit test following a proper convention name based on what the method was doing and was able to figure coherent mock data and gracefully do it. Not so fast, there's a compile error in this code! And telling it without passing much context:

Chat GPT was able to understand what was pointed out and fix it!
Help with some annoying organization tasks
Sometimes we face some very annoying manual tasks that require some time to perform like changing case, order etc. Chat GPT might be able to help with it! Here's an example:


And impressively nailed it!
Add logs
Sometimes we need to add logs to classes and it can be a bit annoying to put it everywhere, or in some cases we find ourselves in a situation when we can't debug and we'll just have to add logs everywhere to understand what's going on. I asked Chat GPT to do it.


It first generated using android.util.Log but I asked to use Timber instead ๐
As we can see it added log to all places โ probably not only the _most important places โ and it was even smart enough to error logs and remove the //Do nothing I had added to onTerminate for linters.
Automation by pattern recognition
This is probably one of the most incredible things I've seen. A few months ago at my day job I stumbled on a situation where we had to get app strings from a server through json and convert it to a bundle key manually and store it in our strings.xml file. Given how boring and repetitive this task was, I created a JS script for me and the team to automate it. Now I thought: What if we had Chat GPT back then? So I decided to give it a try with a sample JSON I created.


And there we have it. It was able to understand what I did and how to do the same for the other properties that required even more work compared to the examples I gave.
Some final disclaimers: - Chat GPT won't always finish all code but you might be able to complete it if you reply "go on"; - Answers might be incomplete or wrong at times, so pay attention on what you're seeing and be critical; - Sometimes it may not seem able to do something, but depending on how you ask, it might actually be able to do it;
Conclusion
Chat GPT is here and it shows how advanced AI systems are nowadays. It can be a very powerful assistant on some tasks to help us save time or even with the learning process when used properly. And as presented, the more creative you get on how to use it the more impressive the things it can do!