Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Your JSON Parses. So Why Did One Value Disappear?

Imagine reviewing a configuration file for a nightly import job. You expect the job to stop after processing 1,000 rows. But the application keeps going until 10,000. The file looks reasonable at first glance: { "task" : "nightly-import" , "limits" : { "max_rows" : 1000 , "max_rows" : 10000 } } There are no missing commas or broken brackets. Your JSON parser doesn't throw an error. Look again at…

A configuration file for a nightly import job was reviewed, expecting the job to stop after processing 1,000 rows. However, after parsing, the application kept running until 10,000 rows. The JSON file appeared correct, but closer inspection revealed a duplicate key for `max_rows` with two different values: `1000` and `10000`. This discrepancy caused issues in how the application processed the data.

The JSON parsing process encountered the duplicate key and only retained the last occurrence, leading to the loss of the initial value. To resolve this issue, it is recommended to check for duplicate keys during the parsing stage rather than after the fact. Implementing a duplicate detection mechanism, such as using Python's `object_pairs_hook`, allows for rejecting duplicate keys and ensuring consistent interpretation of JSON objects.

By rejecting duplicate names at the parsing boundary, developers can avoid unexpected behavior and maintain the integrity of the configuration file or API contract.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Edtech Observability Stack — Health Monitoring Through Logs, Metrics, and Result Deadlines

An uptime check can prove that an edtech app answers requests while its nightly roster import produces nothing. The useful trade-off is signal quality versus noise: alert on a missed, overdue result…

  • Monitor edtech app health via structured logs, metrics, and completion events
  • Implement uptime probe to verify promised outcomes like student record imports
  • Use TypeScript implementation with OpenTelemetry metrics for aggregate measurements

Consistency is not a localized property

  • Consistency cannot be confined to a single component in Apache Kafka.
  • Exactly-once processing requires end-to-end guarantee, application design.
  • Global consistency needs human accountability, not just machine reliability.

Rootful Podman restarts a --uidmap container once on an AppArmor host, then gives up

TL;DR : On a host with AppArmor enabled, a rootful Podman container that has its own ID mapping ( --uidmap / --gidmap ) and a restart policy is restarted once at most.

  • Podman restarts container once with uidmap on AppArmor host
  • Container remains exited after restart, count stops at 1
  • Issue reported upstream as podman-container-tools/podman#29925

More from Sunday 11 October →