NiVO / BY TECHNOGISGermany · Indonesia
Structured data exchange

Repeated JSON Names: Check a Drone GeoJSON Handoff Before Values Disappear

Detect repeated member names while parsing original JSON text, before dictionary conversion hides ambiguity in a drone inventory or GeoJSON delivery.

Repeated JSON Names: Check a Drone GeoJSON Handoff Before Values Disappear

Identify the original text behind the attribute table

A drone inventory can display a single review status even when its delivered JSON text contains that name twice in the same object. Before accepting the table in a NiVO data handoff, identify the original exchange and the parser that produced the visible attributes. This tutorial checks repeated JSON member names before ordinary dictionary conversion can hide them. Its example is an invented, unlocated GeoJSON Feature with two contradictory teaching labels. It does not inspect an actual inventory, establish a customer review status or demonstrate the behavior of a particular NiVO exporter.

Keep the accepted source text and record its revision, producing workflow and intended receiving application. Ask whether the recipient needs an attribute table, a spatial layer or an intermediate document for another conversion. A readable table is useful, but it may show only the parser result rather than every source member pair. Preserve the original before pretty-printing or exporting it again. Once a parser has discarded a repeated pair, serializing its dictionary cannot reconstruct the text that was lost or explain which original value the producer intended to retain.

Distinguish repeated names from repeated records

RFC 8259 recommends unique names within a JSON object and explains that receiving implementations differ when names repeat. Some keep the last pair, some report an error and others preserve more information. Python documents its default last-value behavior and an object_pairs_hook option for changing object decoding. These facts explain why a successful parse alone is insufficient evidence that a delivered object had unambiguous members. A duplicate-name review should operate while the parser still exposes the original pairs, rather than inspecting only the dictionary that remains afterward.

The scope is one object at a time. The same attribute name in two different Features is normal and is not the condition this check rejects. Likewise, a Feature identifier repeated across records is a separate identity question. RFC 7946 defines a Feature properties member that can hold an object or null; nested properties therefore deserve the same pair-level attention as the top level. Keep these questions separate in a report. Rejecting a repeated member inside one object does not prove that the collection has unique assets, complete observations or valid geometry.

NiVO VTOL V7 with a white fuselage, lift rotors, and yellow wing tips
NiVO VTOL V7 with a white fuselage, lift rotors, and yellow wing tips.Source: NiVO / TechnoGIS catalogue materials supplied by the site owner · Catalogue photo
Product context only; this photograph does not depict the constructed examples in this article.

Reject repeated member names during parsing

The Python recipe installs a hook that receives each decoded object as ordered name-value pairs. It builds a dictionary only after checking that no decoded name has already appeared in that object. This catches a repeated name in a nested object as well as at the document root. The example first shows the ordinary parser result, then shows the review policy stopping on the contradictory properties object. The words pending and checked are deliberately invented labels, not a prescribed status vocabulary or a claim about how a NiVO application stores review decisions.

This is a small parsing policy, not a complete strict-JSON or GeoJSON validator. It retains the standard library defaults for other parsing behavior and does not validate the document schema, numeric ranges, coordinate structure or business rules. The exception identifies the first repeated decoded name encountered; it does not provide a full object path, a complete duplicate inventory or source character offsets. Use a suitably bounded, identified input for a real review and retain the original text with any error. Do not convert a rejected parse into an empty collection that appears to contain no findings.

import json

def unique_object(pairs):
    result = {}
    for name, value in pairs:
        if name in result:
            raise ValueError("repeated object member: " + repr(name))
        result[name] = value
    return result

def load_unique_names(text):
    if type(text) is not str:
        raise ValueError("expected original JSON text")
    return json.loads(text, object_pairs_hook=unique_object)

# Constructed unlocated Feature, not an actual inventory record.
text = '''{"type":"Feature","geometry":null,"properties":{
 "review_state":"pending","review_state":"checked"}}'''
print(json.loads(text)["properties"])
try:
    print(load_unique_names(text))
except ValueError as error:
    print(error)

Preserve names as decoded rather than scanning with a text pattern

A text search can help locate a suspicious area, but it cannot reliably decide which occurrences belong to the same JSON object. A name can appear in a string value, in several independent objects or through an escaped spelling. Let the parser identify the member boundaries and decoded names before applying the uniqueness policy. The recipe compares the decoded strings it receives. It does not normalize letter case or apply a project-specific naming convention. If the delivery specification treats differently written names as equivalent, that is an additional explicit rule to assess separately.

Retain the parser version and the exact policy with the report. A failed check should lead to inspection of the accepted source and discussion with the producing workflow. Do not select the first or last value merely because it agrees with an expected result. Even equal repeated values deserve attention under a policy that requires unique names, since a future update could change only one copy. Resolve the source ambiguity through a separately identified corrected revision, then repeat the check before accepting a derived table as the intended representation.

Separate text integrity from geospatial acceptance

Passing the name check establishes only that the inspected parse did not encounter the repeated-name condition handled by this hook. It does not establish required GeoJSON members, valid geometry, coordinate reference meaning or the accuracy of an observation. An unlocated Feature may be intentional, while a missing required member is another structural issue. Keep those findings distinguishable. The product photograph supplies NiVO context and does not depict the invented Feature, its attributes or the output of a real receiving application. No project acceptance is implied by the successful teaching checks.

When a receiving GIS maps JSON properties into fields, record its import settings and preserve any warnings. Compare the relevant values with the accepted source only after the source member interpretation is settled. A later export may rename fields, coerce values or omit unsupported structures; those are separate conversion questions. Avoid using a clean-looking table to retroactively justify a source document whose ambiguity was never resolved. A reproducible review follows the text into the parser result and then into the receiving representation, retaining the assumptions at each stage.

Deliver the parsing policy with the source revision

A useful handoff identifies the original document, parser version, unique-name policy, reported exception and the scope actually checked. Keep any rejected source alongside its corrected successor rather than silently replacing it. Another analyst should be able to run the same parser policy and observe the same stop before applying later schema or spatial checks. If a full diagnostic report is required, use tooling that preserves object paths and source locations; do not present the small hook as though it supplies those capabilities. State unresolved input-size or parsing limitations honestly.

For NiVO inventory discussions, this turns an apparently ordinary attribute value into a traceable question about the delivered member pairs. The tutorial complements Feature-identifier and null-geometry reviews while addressing an earlier parsing stage. Preserve the original text first, settle repeated-name interpretation second and assess the intended geospatial use with its own evidence. A successful dictionary lookup can then be understood as a result of an explicit source policy, rather than mistaken for proof that only one relevant name-value pair ever existed in the delivered document.

Technical references

  1. RFC 8259: object names and interoperability ↗
  2. Python json: repeated names and object_pairs_hook ↗
  3. RFC 7946: Feature properties ↗
← All articles

Related articles

All articles ↗
LET’S TAKE FLIGHT

Your next mission
starts with a conversation.

Talk to our team