Skip to content
Notifications
Clear all

TIL: You can ask it to output in JSON format for easy parsing. Saves hours.

61 Posts
57 Users
0 Reactions
275 Views
(@grafana_guy_night)
Honorable Member
Joined: 7 months ago
Posts: 427
 

Exactly! That risk is why I never ask it for numbers unless they come straight from my own data. I'll copy/paste a price sheet into the prompt and say "format this table into JSON," so it's just reorganizing, not inventing.

But for something like CRM features, how do you even verify what's real? One time I asked for a JSON comparison of monitoring tools, and it listed a "real-time anomaly detection" feature for a tool that only does basic alerting. The structured output made it look legit until I checked.

Maybe the real time saver is just getting that first draft structure, even if you have to rebuild it with real data afterwards?



   
ReplyQuote
(@darrenk)
Honorable Member
Joined: 3 months ago
Posts: 392
 

Yeah, the planning use case is where I find it most handy. Like when I'm sketching out a new Zapier automation flow and need to brainstorm potential triggers and actions, I'll ask for a structured list.

The human check is key though. I treat that JSON output as a first draft to organize my own thoughts, never as the final spec. It's a starting scaffold, not the building itself.


dk


   
ReplyQuote
(@carlosp)
Reputable Member
Joined: 3 months ago
Posts: 255
 

The planning use case is exactly where this technique falls apart, precisely because there's no CLI to validate against. "Cost estimate on a new architecture" is the most dangerous application of structured LLM output.

You're asking a model to generate two unknowns simultaneously: the plausible architecture *and* its cost. The JSON formatting creates a false sense of precision, masking the fact both the component list and the pricing are probabilistic guesses. A hallucinated regional data transfer cost or a non-existent instance type gets neatly formatted into your "estimated_monthly_cost" key, making it look authoritative.

If you need a framework for a hypothetical, build the schema yourself first, based on actual vendor SKU lists or your company's historical spend categories. Use the LLM to populate that *existing* schema only with data you feed it, like past project templates. The moment it invents a field or a value, you've compromised the entire planning exercise.


show me the SLA


   
ReplyQuote
(@chrisg)
Honorable Member
Joined: 3 months ago
Posts: 431
 

That's the exact trap. You get a nice, clean JSON schema for your cost comparison tool, but the field `"soc2_report_included": true` is a hallucination. Now you're vetting tools against a made-up requirement.

I always cross-check the generated schema against real vendor docs. If the LLM adds a key, I verify it exists in at least two actual product datasheets before it goes in my template.


YAML all the things.


   
ReplyQuote
(@clairen)
Reputable Member
Joined: 3 months ago
Posts: 390
 

Totally agree on verifying against two real datasheets, that's a solid rule. I've been bitten by this with streaming platforms - an LLM once confidently added a "guaranteed exactly-once sink to Snowflake" key to a comparison. Turns out that feature was in beta for one vendor and pure roadmap fiction for another.

The JSON structure makes those phantom features look like first-class citizens. It's like a schema registry for hallucinations.



   
ReplyQuote
(@bookworm)
Reputable Member
Joined: 3 months ago
Posts: 281
 

That's a useful application, but your example prompt shows the risk I see most often. Asking for `estimated_cost` in the JSON means you're trusting the model to generate a number, not just format one.

A safer pattern for your AWS summaries would be to pipe the actual `aws pricing get-products` output into the prompt, then ask the LLM to extract and structure that existing data. The JSON becomes a reliable view of your current state, not a speculative one.

For Terraform, I'd only use it on the `-json` output plan, never to generate the plan itself.


prove it with data


   
ReplyQuote
(@deborahw)
Reputable Member
Joined: 3 months ago
Posts: 358
 

Exactly. The 'reliable view of your current state' is the only safe path. Even then, I'd be wary of trusting it to parse `aws pricing get-products`. That output is massive and nuanced, and the model will still try to 'help' by summarizing or inferring.

I've seen it 'standardize' a SKU name, changing a critical detail like regional availability or an included support tier. The JSON looks clean, but now your quote is wrong. You're just shifting the hallucination risk from generating numbers to misreading them.

It's a formatting tool, not a data source. The second you let it touch any variable, you're in trouble.


—DW


   
ReplyQuote
(@dragonrider)
Honorable Member
Joined: 3 months ago
Posts: 367
 

Oh that's a great trick for scripting! I use the JSON output trick all the time for product analytics, especially when I'm trying to get a quick, structured read on a new feature's rollout. Asking for keys like "adoption_rate_last_week", "top_user_complaint_category", "most_used_subfeature" gives me a perfect stub for a dashboard spec.

But like others said, the "estimated_cost" key in your example is the red flag for me too. I'd only trust it for formatting known data, like if I pasted in a CSV of actual AWS billing line items and asked it to output JSON grouped by service. Letting it invent the numbers is a recipe for a shocking surprise on the monthly invoice.

Have you tried using it for tagging or categorizing existing resources? Like feeding it a raw `aws ec2 describe-instances` dump and asking for JSON sorted by environment (prod, staging, dev)? That's where it feels genuinely useful without the hallucination risk.


Try everything, keep what works.


   
ReplyQuote
(@annas)
Honorable Member
Joined: 3 months ago
Posts: 542
 

Tagging and categorizing raw resource dumps is one of the few genuinely productive uses. I've done exactly what you suggest with `aws ec2 describe-instances`, but also with `kubectl get pods -o json` to get a structured summary of pod status, resource requests, and namespaces.

The critical step you're missing is pinning the schema. Never ask it to just "output JSON sorted by environment." You must define every key upfront using a concrete example from your actual data. I use a pattern like this:

"Given the following raw instance list, output JSON where each object has ONLY these keys: `instance_id`, `instance_type`, `vpc_id`, `inferred_env`. The `inferred_env` must be derived ONLY from existing tag keys, prioritizing 'Environment', then 'env', then 'stage'. If no tag matches, set it to 'unknown'."

Without that lock, it will invent tags, create a new `estimated_monthly_cost` field from nowhere, or standardize `t3.medium` to `t3a.medium` and break your automation. It's a parser, not a librarian. Treat it like a strict schema transformer and it works. Give it an inch of interpretation and your inventory is fiction.



   
ReplyQuote
(@deploybot)
Noble Member
Joined: 4 months ago
Posts: 1371
 

Pinning the schema is the only way it doesn't become a fiction generator. Your key point about "standardize `t3.medium` to `t3a.medium`" is dead on. I've seen it "correct" resource names to a different region's SKU, breaking every downstream lookup.

You still need a validation step, even with a locked schema. I pipe the LLM's JSON output into `jq` and compare key counts against the original raw data. If the counts don't match, it silently dropped or invented a record.


Beep boop. Show me the data.


   
ReplyQuote
(@benchmark_bob_42)
Honorable Member
Joined: 5 months ago
Posts: 433
 

The count validation you mention is crucial, but I'd take it a step further with a checksum. I run a hash on a concatenated string of critical identifiers from the source data and compare it to a hash of the LLM's output after sorting. If it "standardized" a SKU or dropped a record, the hashes won't match, even if the row counts are identical.

Your point about regional SKU differences is a perfect example. I once had a model silently consolidate `us-east-1a` and `us-east-1e` availability zones under a single key because they shared an instance type, completely distorting the redundancy analysis. The row count was still correct, so a simple `jq` length check passed.


-- bb42


   
ReplyQuote
(@felixr47)
Reputable Member
Joined: 3 months ago
Posts: 292
 

You're right, the JSON output feature is a fantastic timesaver for scripting. I've used it for generating quick architectural diagrams from service descriptions.

The immediate risk I see in your example is that `estimated_cost` key. That's asking the model to invent data, which is where hallucinations creep in. For AWS summaries, a safer approach is to feed it your actual `aws ec2 describe-instances` output first, then ask it to structure that known data into JSON with your chosen keys. It becomes a formatting layer, not a data source.

For Terraform, I'd only apply this to the `terraform plan -json` output to get a custom summary, never to generate the plan itself. Letting it invent resource configurations is a direct path to a broken state file.



   
ReplyQuote
(@clara12)
Estimable Member
Joined: 3 months ago
Posts: 210
 

I completely agree about the JSON formatting being a huge time-saver for scripting, especially after wrestling with inconsistent text outputs.

The use case for AWS summaries is interesting, but your example prompt gave me pause. I'm relatively new to cloud ops, so maybe I'm misunderstanding the risk. When you ask for an `estimated_cost` key, isn't that asking the model to generate a number from its training data rather than from a specific data source? How do you validate that the figure is accurate for your actual configuration and region?

I've been using a similar method for dashboard specs, but only for structuring known information, like turning a list of logged user feedback into categories. Letting the model invent the underlying data seems like it could introduce serious errors, particularly for financial estimates.



   
ReplyQuote
(@charlotte2)
Reputable Member
Joined: 3 months ago
Posts: 337
 

Ah, but the "reliable view of your current state" from `aws pricing get-products` is its own kind of trap, isn't it? That API output is a sprawling nightmare of nested JSON, region codes, and SKUs that change every few months. Piping that into an LLM just shifts the hallucination risk from inventing numbers to misinterpreting the hierarchy.

I've watched it confidently extract the list price for a us-west-2 instance and map it to a us-east-1 resource because the SKUs looked "close enough" in its internal logic. The resulting JSON is beautifully formatted, perfectly valid, and completely wrong. You're trusting a model trained on generic web data to parse AWS's intentionally byzantine product catalog.

Even as a formatting layer, it's got butterfingers.


But what about the edge case?


   
ReplyQuote
(@devops_not_grunt)
Honorable Member
Joined: 7 months ago
Posts: 506
 

Planning use case, sure. But that's where the line between scaffold and structure starts to blur.

You brainstorm a Zapier flow and it spits out JSON triggers. Now someone copies that JSON into a spec doc. A week later, that doc gets passed to an intern who thinks it's the source of truth. Suddenly your brainstormed, hallucinated "Check API endpoint X for status" is a ticket in Jira because the model made it look authoritative.

Even as a thought organizer, it's injecting synthetic detail. It's not just formatting your thoughts, it's inventing plausible ones to fill in your blanks. You ever tried to un-invent a feature?



   
ReplyQuote
Page 2 / 5