TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Semantic (English) naming conventions for (JSON) data models?

2 pointsby isoosabout 6 years ago
There are a few naming conventions that handle mostly the syntactic part of structure names, e.g. Google&#x27;s JSON style guide is great, with a few references to semantics [1]. Dart&#x27;s style guide adds a few more guideline for half-semantics, e.g. how to handle abbreviations [2].<p><pre><code> [1] https:&#x2F;&#x2F;google.github.io&#x2F;styleguide&#x2F;jsoncstyleguide.xml#Property_Name_Format [2] https:&#x2F;&#x2F;www.dartlang.org&#x2F;guides&#x2F;language&#x2F;effective-dart&#x2F;style </code></pre> Are there guides that target the semantic naming of fields?<p>For example, I&#x27;m running a web scraper, and I extract some information out of it. I have about 90% content that I keep as-is, and 10% that I further parse and classify. I have two examples:<p>First, let&#x27;s say it is some kind of a type (or class, or kind, or category). How would you name (a) the raw&#x2F;orignal text (that is on the downloaded HTML page), and how would you name the (b) parsed identifier (which is internal to the parser application). E.g. raw text may be &quot;Computer- and IT-Accessories&quot;, and your parsed identifier is &quot;computer-accessories&quot;. Some alternatives:<p><pre><code> (a): type, rawType, typeRaw, typeOriginal, sourceType, ... (b): type, parsedType, typeParsed, typeCode, ... </code></pre> Another example is an address line. The (a) original text content could be a single string that has the parts in any order (e.g. city, street, country), while the (b) parsed address should be a structure that has something like {&quot;city&quot;: &quot;...&quot;, &quot;countryCode&quot;: &quot;...&quot;, &quot;street&quot;: &quot;...&quot;, ...}.<p><pre><code> (a): address, rawAddress, addressRaw, sourceAddress, ... (b): address, parsedAddress, addressParsed, ... </code></pre> Which combination would you choose and why?

no comments

no comments