Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:APIJSON APIJSON Demo JSONObject JS

From Leeroopedia
Knowledge Sources
Domains API_Design, JSON_Parsing, Frontend
Last Updated 2026-10-14 00:00 GMT

Overview

Concrete tool for identifying APIJSON key types (table keys, array keys, function keys) and common JSON object operations in the APIJSON Demo frontend.

Description

The JSONObject JavaScript module provides utility functions for determining whether a JSON key represents a table name, array name, or function call based on APIJSON naming conventions. It uses regex patterns (e.g., /^[A-Z][A-Za-z0-9_]*$/) to distinguish table keys from function keys. It also provides isEmpty and log helpers.

Usage

Import this module when you need to parse or validate APIJSON key structures in browser-side JavaScript code.

Code Reference

Source Location

Signature

var JSONObject = {
  TAG: 'JSONObject',
  log: function(tag, msg),
  isEmpty: function(obj),
  isTableKey: function(key, value, isRestful),
  isArrayKey: function(key, value, isRestful),
  isPathKey: function(key, value, isRestful),
  isFunctionKey: function(key, value, isRestful),
  // ...
};

Import

var JSONObject = require("./JSONObject");
// or via script tag in browser

I/O Contract

Inputs

Name Type Required Description
key String Yes JSON key to classify
value Any No JSON value associated with key
isRestful Boolean No Whether RESTful URL mode is active

Outputs

Name Type Description
isTableKey() returns Boolean Whether key matches table name pattern
isArrayKey() returns Boolean Whether key matches array name pattern
isFunctionKey() returns Boolean Whether key contains function call syntax

Usage Examples

Classify a JSON Key

var JSONObject = require("./JSONObject");

// Table keys start with uppercase
console.log(JSONObject.isTableKey("User"));    // true
console.log(JSONObject.isTableKey("id"));      // false

// Array keys end with []
console.log(JSONObject.isArrayKey("User[]"));  // true
console.log(JSONObject.isArrayKey("User"));    // false

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment