You are here: Kinds of code · JSON

Packed data

A labeled lunch box. Not a language you write apps in.

When Termux asks the phone how full the battery is, the answer arrives as structured text called JSON. You read the label. You take out the number. You print it.

{
  "": ,
  "": ""
}

Tap a yellow word

Labels on the left. Values on the right. Curly braces mean “this is one packed object.”

You do not need to memorize the battery script yet

The source file shows import, subprocess, and json.loads. Plain meaning: run the phone’s battery command, read the packed answer, print the percentage. The point is that your text file can ask the phone a question and use the answer.