Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/vmelnichenko/json-immutable-xs

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/vmelnichenko/json-immutable-xs

  • v0.0.0-20220329083712-27f221724a16
  • Source
  • Go
  • Socket score

Version published
Created
Source

Name JSON::Immutable::XS

DESCRIPTION Fast and simple abstract node-tree based storage with JSON support. Usefull for reading JSON configs, keeping it in the memory and don't worrying about mutability. Has XPath-like interface for data accessing. Easy to use with XS and C/C++ modules.

It use RapidJSON as JSON parser. https://rapidjson.org/

SYNOPSIS use JSON::Immutable::XS;

# you can provide this variable to XS and use it there
my $dict = JSON::Immutable::XS->new('example/dict.json');

# get subnode by path ( any node is JSON::Immutable::XS ref)
my $node = $dict->get( 'path', 2, 'node'); # similar to ->{path}[2]{node}
# get() returns undef on not existed path

my $data = $node->get_value('this', 'is', 'the', 'way'); # data could be an any Perl Sv structure ( scalar, hash or array )

# unless path will found - it'll return undef

# it possible to get keys from node as well
for ( @{$dict->keys()} ){
    ...
}

# use slice to get exactly that you need without unnecessary data ( detail description below )
$dict->slice( 'path' );

# see more features below

PERL INTERFACE new() Creating of new instance. You can provide filename - it will be parsed as JSON

get()
    Finding a node by path (may be empty) and returning instance of node as ref 'JSON::Immutable::XS'. May be use any functions of this interface

get_value()
    Finding a node by path (may be empty) and returning Perl Sv. It could be Hash or Array or Scalar.

keys()
    Get keys of hash for node. Can use path.

exists()
    Checking of path existing.

slice()
    Get value by path for every key of hash or element of array.

export()
    Same as get_value() without path

AUTHOR Vladimir Melnichenko melnichenkovv@gmail.com, Crazy Panda, CP Decision LTD https://github.com/VMELNICHENKO/JSON-Immutable-XS

LICENSE You may distribute this code under the same terms as RapidJSON itself. https://rapidjson.org/

FAQs

Package last updated on 29 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc