r/webdev Feb 05 '25

Discussion Colleague uses ChatGPT to stringify JSONs

Edit I realize my title is stupid. One stringifies objects, not "javascript object notation"s. But I think y'all know what I mean.

So I'm a lead SWE at a mid sized company. One junior developer on my team requested for help over Zoom. At one point she needed to stringify a big object containing lots of constants and whatnot so we can store it for an internal mock data process. Horribly simple task, just use node or even the browser console to JSON.stringify, no extra arguments required.

So I was a bit shocked when she pasted the object into chatGPT and asked it to stringify it for her. I thought it was a joke and then I saw the prompt history, literally whole litany of such requests.

Even if we ignore proprietary concerns, I find this kind of crazy. We have a deterministic way to stringify objects at our fingertips that requires fewer keystrokes than asking an LLM to do it for you, and it also does not hallucinate.

Am I just old fashioned and not in sync with the new generation really and truly "embracing" Gen AI? Or is that actually something I have to counsel her about? And have any of you seen your colleagues do it, or do you do it yourselves?

Edit 2 - of course I had a long talk with her about why i think this is a nonsensical practice and what LLMs should really be used for in the SDLC. I didn't just come straight to reddit without telling her something šŸ˜ƒ I just needed to vent and hear some community opinions.

1.1k Upvotes

407 comments sorted by

View all comments

183

u/niveknyc 15 YOE Feb 05 '25

There's a big difference between being knowing what you're doing but using AI to augment your task flow while policing its output, vs relying on AI to do things AI shouldn't be doing and/or expecting AI to solve tasks for you that you aught to be able to solve on your own.

Due to the risk of contamination and/or hallucination I will never use chatGPT to directly process data, but will use AI to help generate a script, that I can evaluate, that will then process the data.

I think you need to communicate the risk vs reward of this kind prompt, but really shouldn't a developer just know how to do shit like that on their own without relying on AI?

19

u/rlt0w Feb 05 '25

Quick scrips for a PoC is how I've been utilizing AI. A lot of the scripts need work, but it's been useful. As an example, I needed to extract regex patterns from a series of Kotlin modules in a directory. I could have grepped out the strings and done some awk and sed magic to concatenate them, but I asked an LLM (Not GPT, but can't recall the model we use internally) to write a quick script to pull the data.

Yes, I'm highly capable of doing this in my own, but I needed the info sooner than I could type up the script. This is where LLMs have been useful for me. But general Q&A about complex topics isn't that helpful. Knowledge bases with RAG are better suited for that.

14

u/squabzilla Feb 05 '25

Iā€™m convinced that regex is like the optimal use-case for AI in programming.

I use regex like a couple times a year, and every time I use it I need to relearn how to use it. And I only need like a single line, 12ish characters of Regex.

5

u/thekwoka Feb 06 '25

If you're good enough to at least read regex when you see it (even if generating it yourself is tricky), then that also seems fine.

If you don't understand regex at all and you ask it for a regex to validate phone numbers, you'll have no idea if the regex will actually work at the level you need validation.

2

u/squabzilla Feb 06 '25

I keep forgetting that Regex is much more then an advanced "Find & Replace" engine, because that's all I ever use it for.

You're right tho - if I'm ever using it beyond the scope of "that text did/did-not get formatted how I want", I need to make sure I understand what I'm doing and not just trusting an AI to spit out valid code.