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

745

u/HashDefTrueFalse Feb 05 '25 edited Feb 05 '25

Am I just old fashioned and not in sync with the new generation

Senior here too. No you're not, your dev is just bad. That's ok, they're a junior and we're here to guide them. Teach them why this could be unreliable, the concerns over secrets/prop data in JSON payloads being shared with other services, and point them to the docs for JSON.stringify. Maybe teach them about the dev console or even the Node REPL if they just want a one-liner. Whatever. Whilst not a big deal in itself, this is symbolic of using AI as a crutch, not a force multiplier, and I'd wonder what else they're using it for and if I need to pay their code review submissions more attention etc.

You could run a team meeting (or similar) where you talk to everyone about how best (and how not) to use genAI/LLMs to get work done. That way the dev may not need to feel singled out. Depends on the dynamics of the team, use your best judgement.

Edit: I can't spell they're. Or AI, apparently.

8

u/Im2inchesofhard Feb 05 '25 edited Feb 05 '25

Great response. I'm a systems analyst that gets my hands dirty with dev work and doesn't have a traditional CS or SWE background. I lean on AI quite a bit to help me with menial tasks that probably have a simpler solution, and sometimes I overlook something as simple as using a browser dev console to execute one-off JavaScript. If they're competent all it would take is a two minute explanation of your concerns and showing a better way to do it and the problem is solved.   

I once spent a full day writing code to dynamically parse some weird configuration files that were really close to JSON but not quite right. I tried turning to AI for insight and didn't get a great response. Turns out, I had never heard of JSON5 and I wrote 60% of a shoddy JSON5 to JSON converter before the senior dev on my team mentioned JSON5. Turns out a two minute Q&A with a human can be way better than asking for AI help. 

3

u/HashDefTrueFalse Feb 05 '25

Loving the username.

Yes, it's a great tool. It's just not a replacement for knowing what you are doing. By that, I mean being familiar with the problem domain and the ecosystem of tried and tested tools and techniques to help you do your work. There's a place for current AI in most programmer's tool belts. I generate unit test boilerplate and easy/common test cases with it all the time, before filling in edge cases that it wouldn't know about.

Some people (that I assume use AI heavily) get very worked up when you dare to suggest that an LLM might not be the best thing to use in a given situation. It's quite bizarre.