mapflablup

Mapflablup is a library to flatten and blowup Map Collection

License

License

MIT
GroupId

GroupId

io.github.mvillafuertem
ArtifactId

ArtifactId

mapflablup_2.12
Last Version

Last Version

0.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

mapflablup
Mapflablup is a library to flatten and blowup Map Collection
Project URL

Project URL

https://github.com/mvillafuertem/mapflablup
Project Organization

Project Organization

mvillafuertem
Source Code Management

Source Code Management

https://github.com/mvillafuertem/mapflablup

Download mapflablup_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.mvillafuertem/mapflablup_2.12/ -->
<dependency>
    <groupId>io.github.mvillafuertem</groupId>
    <artifactId>mapflablup_2.12</artifactId>
    <version>0.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.mvillafuertem/mapflablup_2.12/
implementation 'io.github.mvillafuertem:mapflablup_2.12:0.1.1'
// https://jarcasting.com/artifacts/io.github.mvillafuertem/mapflablup_2.12/
implementation ("io.github.mvillafuertem:mapflablup_2.12:0.1.1")
'io.github.mvillafuertem:mapflablup_2.12:jar:0.1.1'
<dependency org="io.github.mvillafuertem" name="mapflablup_2.12" rev="0.1.1">
  <artifact name="mapflablup_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.mvillafuertem', module='mapflablup_2.12', version='0.1.1')
)
libraryDependencies += "io.github.mvillafuertem" % "mapflablup_2.12" % "0.1.1"
[io.github.mvillafuertem/mapflablup_2.12 "0.1.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.8
org.json4s : json4s-jackson_2.12 jar 3.6.5

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.12 jar 3.0.5

Project Modules

There are no modules declared in this project.

Mapflablup

License: MIT codecov CircleCI

Mapflablup is a library to flat โž– and blowup ๐ŸŽˆ Map Collection

Usage

Please see our scala tests!

Include mapflablup in your project build.sbt
libraryDependencies += "io.github.mvillafuertem" %% "mapflablup" % "0.1"

You can use this library with https://github.com/alibaba/fastjson

val jsonString = """{...}"""

val json = new JSONObject(jsonString)

val resultFlatted = MapFlatten(json).flatten

val resultBlowUp = MapBlowUp(resultFlatted).blowUp

Example

Convert String to JSONObject
val jsonString = """{...}"""
val json = new JSONObject(jsonString)
Given a map as json
{
  "_id": "5c5f1f313fcc6e3084fbe65e",
  "index": 0,
  "guid": "f3b5960b-f3e1-4556-9a5d-f552afe204e7",
  "isActive": true,
  "balance": "$2,809.92",
  "picture": "http://placehold.it/32x32",
  "age": 28,
  "eyeColor": "blue",
  "personalinfo": {
    "name": "Elliott Kaufman",
    "gender": "male",
    "phone": "+1 (858) 421-2925",
    "email": "[email protected]",
    "address": "952 Cropsey Avenue, Tyro, Guam, 1787",
    "company": {
      "name": "SPACEWAX"
    }
  },
  "about": "Labore tempor cupidatat nulla veniam ea veniam aliqua ea. Ad id id dolor enim quis amet irure ad occaecat. Quis enim enim esse mollit. Et officia officia ea consectetur deserunt eiusmod nisi ex culpa consectetur.\r\n",
  "registered": "2015-03-28T06:35:33 -01:00",
  "location": {
    "latitude": 78.370719,
    "longitude": -137.117139
  },
  "greeting": "Hello, Elliott Kaufman! You have 5 unread messages.",
  "favoriteFruit": "strawberry"
}
Apply MapFlat
Map(
    registered -> 2015-03-28T06:35:33 -01:00,
    eyeColor -> blue,
    guid -> f3b5960b-f3e1-4556-9a5d-f552afe204e7,
    favoriteFruit -> strawberry,
    isActive -> true,
    greeting -> Hello, Elliott Kaufman! You have 5 unread messages.,
    picture -> http://placehold.it/32x32,
    personalinfo.name -> Elliott Kaufman,
    personalinfo.gender -> male,
    personalinfo.address -> 952 Cropsey Avenue, Tyro, Guam, 1787,
    personalinfo.company.name -> SPACEWAX,
    personalinfo.phone -> +1 (858) 421-2925,
    personalinfo.email -> [email protected], l
    ocation.latitude -> 78.370719,
    location.longitude -> -137.117139,
    _id -> 5c5f1f313fcc6e3084fbe65e, age -> 28,
    index -> 0, balance -> $2,809.92,
    about -> Labore tempor cupidatat nulla veniam ea veniam aliqua ea. Ad id id dolor enim quis amet irure ad occaecat. Quis enim enim esse mollit. Et officia officia ea consectetur deserunt eiusmod nisi ex culpa consectetur.
)
Apply MapBlowUp
Map(
    registered -> 2015-03-28T06:35:33 -01:00,
    eyeColor -> blue,
    guid -> f3b5960b-f3e1-4556-9a5d-f552afe204e7,
    favoriteFruit -> strawberry,
    isActive -> true,
    greeting -> Hello, Elliott Kaufman! You have 5 unread messages.,
    picture -> http://placehold.it/32x32,
    personalinfo -> Map(
        name -> Elliott Kaufman,
        gender -> male,
        address -> 952 Cropsey Avenue, Tyro, Guam, 1787,
        phone -> +1 (858) 421-2925,
        email -> [email protected],
        company -> Map(
            name -> SPACEWAX
        )
    ),
    location -> Map(
        latitude -> 78.370719,
        longitude -> -137.117139
    ),
    _id -> 5c5f1f313fcc6e3084fbe65e,
    age -> 28,
    index -> 0,
    balance -> $2,809.92,
    about -> Labore tempor cupidatat nulla veniam ea veniam aliqua ea. Ad id id dolor enim quis amet irure ad occaecat. Quis enim enim esse mollit. Et officia officia ea consectetur deserunt eiusmod nisi ex culpa consectetur.
)

License

The MIT License (MIT). Please see License for more information.

Versions

Version
0.1.1
0.1