Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

28
LINES

< > BotCompany Repo | #1015823 // JSON Parser (Dyn Module)

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (14601L/101K).

!7

sclass JSONParser > DynModule {
  transient SimpleLiveValue<S> output = new(S);
  transient SimpleLiveValue<S> input = new(S);
  transient ReliableSingleThread rst = new(r parse);
  
  visualize { ret jLiveValueWordWrapTypeWriterTextArea(output); }
  
  start {
    dm_onTopInput(r updateMe);
    input.onChange(rst);
  }
  
  void update {
    input.set(dm_interestingString());
  }
  
  void parse {
    output.set("Parsing...");
    try {
      O o = jsonDecode(input!);
      output.set("Text relaxedly parses as JSON (" + shortClassName(o) + ")");
    } catch e {
      output.set("Parse error. " + exceptionToStringShort(e));
    }
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1015823
Snippet name: JSON Parser (Dyn Module)
Eternal ID of this version: #1015823/14
Text MD5: 8ee5f49ec2e60a6d182dd01d76c24d5f
Transpilation MD5: 745a094960314830d352e1fcca9a5b47
Author: stefan
Category:
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-14 16:56:25
Source code size: 671 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 429 / 862
Version history: 13 change(s)
Referenced in: