Giter VIP home page Giter VIP logo

jsons-for-ahkv2's Introduction

Jsons.ahk for AHKv2

The lazy man's json. Inspired by: https://pypi.org/project/jsons/

Forked from TheArkive https://github.com/TheArkive/JXON_ahk2

This is a normal Json library, with a built in function to handle and convert all Objects to Maps. Feed anything into Dump, and it should return a proper serialized string. Autohotkeyv2 & AHKv2

Use

Serialize

var := Jsons.Dump(obj, indent:=0)

Convert to obj

obj := Jsons.Load(&text)

In the future, I'll try to convert to objects a la https://github.com/Jim-VxE/AHK-Lib-JSON_ToObj

test input:

class Test
{
    __New(){
        this.valA := "valA"
        this.valB := "valB"
    }
}
ClassObj := Test()
ObjB := {1:2}
MapA := Map("test", {ObjB:"x"})
x := {
    ClassObjects: [ClassObj,ClassObj],
    1: 2,
    4: [1, ClassObj],
    z: Map(1,2),
    ObjB:ObjB,
    y:MapA
}
jdata := Jsons.Dump(x, indent:=2)

output:

{
  "1": 2,
  "4": [
    1,
    {
      "valA": "valA",
      "valB": "valB"
    }
  ],
  "ClassObjects": [
    {
      "valA": "valA",
      "valB": "valB"
    },
    {
      "valA": "valA",
      "valB": "valB"
    }
  ],
  "ObjB": {
    "1": 2
  },
  "y": {
    "test": {
      "ObjB": "x"
    }
  },
  "z": {
    "1": 2
  }
}

jsons-for-ahkv2's People

Contributors

samfisherirl avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

poa00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.