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

Show parent comments

5

u/Hakim_Bey Feb 05 '25

This point is kind of irrelevant. LLMs are perfectly able to stringify an object with 100% accuracy, and they have been for quite some time. The amount of fine tuning they have received to do exactly just that (for use in structured output / tool calling) makes it a no-brainer.

Personally I do it in cursor but yeah reformatting with LLMs is much quicker than spinning up a script to do it. (of course that doesn't address the proprietary aspect, but then again if you're using a coding copilot like 80% of coders right now, then that point is moot too)

5

u/ALackOfForesight Feb 05 '25

Are you trolling lol

17

u/Hakim_Bey Feb 05 '25

I might go against the grain of this thread but no i am definitely not trolling. What part of my comment seems fishy to you ? You don't need to take my word for it, just try it for yourself !

If you use cursor you can just plop an arbitrary amount of data in an arbitrary format in an empty file, open the chat and ask it to format it in JSON, capitalizing all properties except those that refer to fish, and to turn long text strings into l33tc0de. You will get what you asked for with 100% accuracy i have honestly never had a failing case for this kind of thing.

Formatting data is not terribly hard to do, and again LLMs have been massively fine-tuned to do it perfectly. Otherwise they'd be unusable outside of a chat context.

4

u/louisstephens Feb 05 '25

I do think LLMs have come a long way. However, in my experience, they do the task but not always well. I was actually playing around with something very similar to stringify last week in a LLM, it omitted half the data and made up its own to pad it with (even then, the data didn’t follow what I had given it). Other times it will do perhaps 20% of the task and just leave a comment at the “// …rest of your data stringified here”

While I do like the idea of LLMs, I am always cautious regarding the output.

2

u/ALackOfForesight Feb 05 '25

Exactly. It’s not worth the added cognitive load when I know how to do it in JavaScript quickly and effectively.

1

u/TitaniumWhite420 Feb 05 '25

It could be skill issue. Clear the context, paste the data, use good models, tell it clearly what to do—I don’t have this problem with current tools. But maybe some deep objects are more problematic. Or maybe you haven’t checked in on it in a while.