Git Product home page Git Product logo

jsonq's Introduction

php-jsonq

JsonQ is a simple, elegant PHP package to Query over any type of JSON Data. It'll make your life easier by giving the flavour of an ORM-like query on your JSON.

Support For This Project

Hey due, please help me out for daily improve this project

Beerpay

NOTE

From the version JsonQ 6.0 all the features rewrite from QAarray. After a long run we noticed that Query Engine of JsonQ should be seperate. Becouse people want to query over various types of data like CSV, YAML, XML. So if we keep the query engine tightly coupled with this project its make no sense. Thats why we move the Query Engine part and develop a new package QAarray. Qarray is designed for queryng over native PHP array and anyone can implement their own Engine, like JsonQ.

Please do not update to >= 6.0 version directly from bellow

Installation

composer require nahid/jsonq

Usage

You can start using this package right away by importing your JSON data from a file:

use Nahid/JsonQ/Jsonq;
$jsonq = new Jsonq('data.json');

Or from a JSON String:

$json->json('{"id": 1, "name": "Nahid"}');

Or from a PHP Array:

$json->collect(['id'=>1, 'name'=>'Nahid']);

You can start Query your data using the various query methods such as find, where, orWhere, whereIn, whereStartsWith, whereEndsWith, whereContains and so on. Also you can aggregate your data after query using sum, count, groupBy, max, min etc.

Let's see a quick example:

//data.json
{
   "name": "products",
   "description": "Features product list",
   "vendor":{
      "name": "Computer Source BD",
      "email": "[email protected]",
      "website":"www.example.com"
   },
   "users":[
      {"id":1, "name":"Johura Akter Sumi", "location": "Barisal"},
      {"id":2, "name":"Mehedi Hasan Nahid", "location": "Barisal"},
      {"id":3, "name":"Ariful Islam", "location": "Barisal"},
      {"id":4, "name":"Suhel Ahmed", "location": "Sylhet"},
      {"id":5, "name":"Firoz Serniabat", "location": "Gournodi"},
      {"id":6, "name":"Musa Jewel", "location": "Barisal", "visits": [
         {"name": "Sylhet", "year": 2011},
         {"name": "Cox's Bazar", "year": 2012},
         {"name": "Bandarbar", "year": 2014}
      ]}
   ],
   "products": [
      {"id":1, "user_id": 2, "city": "bsl", "name":"iPhone", "cat":1, "price": 80000},
      {"id":2, "user_id": 2, "city": null, "name":"macbook pro", "cat": 2, "price": 150000},
      {"id":3, "user_id": 2, "city": "dhk", "name":"Redmi 3S Prime", "cat": 1, "price": 12000},
      {"id":4, "user_id": 1, "city": null, "name":"Redmi 4X", "cat":1, "price": 15000},
      {"id":5, "user_id": 1, "city": "bsl", "name":"macbook air", "cat": 2, "price": 110000},
      {"id":6, "user_id": 2, "city": null, "name":"macbook air 1", "cat": 2, "price": 81000}
   ]
}
use Nahid\JsonQ\Jsonq;

$q = new Jsonq('data.json');
$res = $q->from('products')
    ->where('cat', '=', 2)
    ->get();
dump($res);

//This will print
/*
array:3 [▼
  1 => {#7 ▼
    +"id": 2
    +"user_id": 2
    +"city": null
    +"name": "macbook pro"
    +"cat": 2
    +"price": 150000
  }
  4 => {#8 ▼
    +"id": 5
    +"user_id": 1
    +"city": "bsl"
    +"name": "macbook air"
    +"cat": 2
    +"price": 110000
  }
  5 => {#9 ▼
    +"id": 6
    +"user_id": 2
    +"city": null
    +"name": "macbook air 1"
    +"cat": 2
    +"price": 81000
  }
]
*/

Let's say we want to get the Summation of price of the Queried result. We can do it easily by calling the sum() method instead of get():

$result = $json->from('products')
        ->where('cat', '=', 2)
        ->sum('price');
dump($result);

//It will print:
/*
365000
*/

Pretty neat, huh?

Let's explore the full API to see what else magic this library can do for you. Shall we?

API

Following API examples are shown based on the sample JSON data given here. To get a better idea of the examples see that JSON data first. Also detailed examples of each API can be found here.

List of API:

fetch()

This method will execute queries and will return the resulted data. You need to call it finally after using some query methods. Details can be found in other API examples.

find(path)

  • path -- the path hierarchy of the data you want to find.

You don't need to call fetch() method after this. Because this method will fetch and return the data by itself.

caveat: You can't chain further query methods after it. If you need that, you should use at() or from() method.

example:

Let's say you want to get the value of 'cities' property of your Json Data. You can do it like this:

$q = new Jsonq('data.json');
echo $q->find('vendor.name');

If you want to traverse to more deep in hierarchy, you can do it like:

$q = new Jsonq('data.json');
echo $q->find('vendor.name');

See a detail example here.

from(path)

  • path (optional) -- the path hierarchy of the data you want to start query from.

By default, query would be started from the root of the JSON Data you've given. If you want to first move to a nested path hierarchy of the data from where you want to start your query, you would use this method. Skipping the path parameter or giving '.' as parameter will also start query from the root Data.

Difference between this method and find() is that, find() method will return the data from the given path hierarchy. On the other hand, this method will return the Object instance, so that you can further chain query methods after it.

example:

Let's say you want to start query over the values of 'vendor.name' property of your JSON Data. You can do it like this:

$q = new Jsonq('data.json');
echo $q->from('vendor.name')->get();

If you want to traverse to more deep in hierarchy, you can do it like:

$q = new Jsonq('data.json');
echo $q->from('users.5.visits')->get();

See a detail example here.

at(path)

This is an alias method of from() and will behave exactly like that. See example here.

where(key, condition, val)

  • key -- the property name of the data. Or you can pass a Function here to group multiple query inside it. See details in example

  • val -- value to be matched with. It can be a int, string, bool or even Function - depending on the op.

  • op -- operand to be used for matching. The following operands are available to use:

    • = : For weak equality matching
    • eq : Same as =
    • != : For weak not equality matching
    • neq : Same as !=
    • == : For strict equality matching
    • seq : Same as ==
    • !== : For strict not equality matching
    • sneq : Same as !==
    • > : Check if value of given key in data is Greater than val
    • gt : Same as >
    • < : Check if value of given key in data is Less than val
    • lt : Same as <
    • >= : Check if value of given key in data is Greater than or Equal of val
    • gte : Same as >=
    • <= : Check if value of given key in data is Less than or Equal of val
    • lte : Same as <=
    • null : Check if the value of given key in data is null (val parameter in where() can be omitted for this op)
    • notnull : Check if the value of given key in data is not null (val parameter in where() can be omitted for this op)
    • in : Check if the value of given key in data is exists in given val. val should be a plain Array.
    • notin : Check if the value of given key in data is not exists in given val. val should be a plain Array.
    • startswith : Check if the value of given key in data starts with (has a prefix of) the given val. This would only works for String type data.
    • endswith : Check if the value of given key in data ends with (has a suffix of) the given val. This would only works for String type data.
    • contains : Check if the value of given key in data has a substring of given val. This would only works for String type data.
    • match : Check if the value of given key in data has a Regular Expression match with the given val. The val parameter should be a RegExp for this op.
    • macro : It would try to match the value of given key in data executing the given val. The val parameter should be a Function for this op. This function should have a matching logic inside it and return true or false based on that.

example:

Let's say you want to find the 'users' who has id of 1. You can do it like this:

$q = new Jsonq('data.json');
$res = $q->from('users')->where('id', '=', 1)->get();

You can add multiple where conditions. It'll give the result by AND-ing between these multiple where conditions.

$q = new Jsonq('data.json');
$res = $q->from('users')
->where('id', '=', 1)
->where('location', '=', 'barisal')
->get();

See a detail example here.

orWhere(key, op, val)

Parameters of orWhere() are the same as where(). The only difference between where() and orWhere() is: condition given by the orWhere() method will OR-ed the result with other conditions.

For example, if you want to find the users with id of 1 or 2, you can do it like this:

$q = new Jsonq('data.json');
$res = $q->from('users')
->where('id', '=', 1)
->orWhere('id', '=', 2)
->get();

See detail example here.

whereIn(key, val)

  • key -- the property name of the data
  • val -- it should be an Array

This method will behave like where(key, 'in', val) method call.

whereNotIn(key, val)

  • key -- the property name of the data
  • val -- it should be an Array

This method will behave like where(key, 'notin', val) method call.

whereNull(key)

  • key -- the property name of the data

This method will behave like where(key, 'null') or where(key, '=', null) method call.

whereNotNull(key)

  • key -- the property name of the data

This method will behave like where(key, 'notnull') or where(key, '!=', null) method call.

whereStartsWith(key, val)

  • key -- the property name of the data
  • val -- it should be a String

This method will behave like where(key, 'startswith', val) method call.

whereEndsWith(key, val)

  • key -- the property name of the data
  • val -- it should be a String

This method will behave like where(key, 'endswith', val) method call.

whereContains(key, val)

  • key -- the property name of the data
  • val -- it should be a String

This method will behave like where(key, 'contains', val) method call.

sum(column)

  • column -- the property name of the data

example:

Let's say you want to find the sum of the 'price' of the 'products'. You can do it like this:

$q = new Jsonq('data.json');
$res = $q->from('products')
->where('cat', '=', 1)
->sum('price');

If the data you are aggregating is plain array, you don't need to pass the 'column' parameter. See detail example here

count()

It will return the number of elements in the collection.

example:

Let's say you want to find how many elements are in the 'products' property. You can do it like:

$q = new Jsonq('data.json');
$res = $q->from('products')
->where('cat', '=', 1)
->count();

See detail example here.

size()

This is an alias method of count().

max(column)

  • column -- the property name of the data

example:

Let's say you want to find the maximum of the 'price' of the 'products'. You can do it like this:

$q = new Jsonq('data.json');
$res = $q->from('products')
->where('cat', '=', 1)
->max('price);

If the data you are querying is plain array, you don't need to pass the 'column' parameter. See detail example here

min(column)

  • column -- the property name of the data

example:

Let's say you want to find the minimum of the 'price' of the 'products'. You can do it like this:

$q = new Jsonq('data.json');
$res = $q->from('products')
->where('cat', '=', 1)
->min('price');

If the data you are querying is plain array, you don't need to pass the 'property' parameter. See detail example here

avg(column)

  • column -- the property name of the data

example:

Let's say you want to find the average of the 'price' of the 'products'. You can do it like this:

$q = new Jsonq('data.json');
$res = $q->from('products')
->where('cat', '=', 1)
->avg('price');

If the data you are querying is plain array, you don't need to pass the 'column' parameter. See detail example here

first()

It will return the first element of the collection.

example:

$q = new jsonq('data.json');
$res = $q->from('products')
->where('cat', '=', 1)
->first();

See detail example here.

last()

It will return the last element of the collection.

example:

$q = new Jsonq('data.json');
$res = $q->from('products')
->where('cat', '=', 1)
->last();

See detail example here.

nth(index)

  • index -- index of the element to be returned.

It will return the nth element of the collection. If the given index is a positive value, it will return the nth element from the beginning. If the given index is a negative value, it will return the nth element from the end.

example:

$q = new Jsonq('data.json');
$res = $q->from('products')
->where('cat', '=', 1)
->nth(2);

See detail example here.

exists()

It will return true if the element is not empty or not null or not an empty array or not an empty object.

example:

Let's say you want to find how many elements are in the 'products' property. You can do it like:

$q = new Jsonq('data.json');
$res = $q->from('products')
->where('cat', '=', 1)
->exists();

See detail example here.

groupBy(column)

  • column -- The property by which you want to group the collection.

example:

Let's say you want to group the 'users' data based on the 'location' property. You can do it like:

$q = new Jsonq('data.json');
$res = $q->from('users')
->groupBy('location')
->get();

See detail example here.

sort(order)

  • order -- If you skip the 'order' property the data will be by default ordered as ascending. You need to pass 'desc' as the 'order' parameter to sort the data in descending order. Also, you can pass a compare function in 'order' parameter to define your own logic to order the data.

Note: This method should be used for plain Array. If you want to sort an Array of Objects you should use the sortBy() method described later.

example:

Let's say you want to sort the 'arr' data. You can do it like:

$q = new Jsonq();
$res = $q->collect([7, 5, 9, 1, 3])
->sort();

See detail example here.

sortBy(column, order)

  • column -- You need to pass the column name on which the sorting will be done.
  • order -- If you skip the 'order' property the data will be by default ordered as ascending. You need to pass 'desc' as the 'order' parameter to sort the data in descending order. Also, you can pass a compare function in 'order' parameter to define your own logic to order the data.

Note: This method should be used for Array of Objects. If you want to sort a plain Array you should use the sort() method described earlier.

example:

Let's say you want to sort the 'price' data of 'products'. You can do it like:

$q = new Jsonq('data.json');
$res = $q->from('products')
->where('cat', '=', 1)
->sortBy('price', 'desc');

See detail example here.

reset(data)

  • data -- can be a JSON file path, or a JSON string or a JSON Object. If no data passed in the data parameter, the jsonQ Object instance will be reset to previously initialized data.

At any point, you might want to reset the Object instance to a completely different set of data and then query over it. You can use this method in that case.

See a detail example here.

copy()

It will return a complete clone of the Object instance.

See a detail example here.

Bugs and Issues

If you encounter any bugs or issues, feel free to open an issue at github.

Also, you can shoot me an email to mailto:[email protected] for hugs or bugs.

Others Platform

This package has also different language support.

Support on Beerpay

Hey dude! Help me out for a couple of 🍻!

Beerpay Beerpay

jsonq's People

Contributors

atefbb avatar erickzh avatar githubhubus avatar lo00l avatar me-shaon avatar nahid avatar solstis86 avatar svenluijten avatar tobias-kuendig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsonq's Issues

Getting nth data

In my use case I want to get all results for a certain nth depth.

 "rest": [
    {
      "mode": "server",
      "resource": [
          "type": "AllergyIntolerance",
      "resource": [
          "type": "MedicationStatement",

So I want to return all resource types:
i.e.
["AllergyIntolerance","MedicationStatement"]

Is that possible?
The nth example does not link anywhere?

installation error

I installed it with composer and included it on my own code and I get syntax error, unexpected 'use' (T_USE).
Here is my code
`require DIR . '/vendor/autoload.php'

use Nahid/JsonQ/Jsonq;`
any solutions?

#HELP How to Use the "Or from a JSON String"

Sorry before, im a beginner.
i dont know how to use it from JSON string.
like this
$json->json('{"id": 1, "name": "Nahid"}');

when i use like this
$q = new Jsonq();
$q = $q->json([json string]);
but function not found.

can you help me show the full code?

How to use a previous set as a new set to query over those results?

I like to use a pre queried result set to do another query over, I do not get it to work.

if I did this:
$jsonQO->Where('Position.Status', '=', $value);
$jsonQO->Where('Position.Hours', '=', $othervalue);
$jsonQO->Where(Position.Location, '=', $jetAnotherValue);
$jsonQO->from('vacancy')->get();

Now I want to do another where on the results
I tryed :
$jsonQO = $jsonQO->from('vacancy')->get();
$jsonQO->where('Position.JobTitle', 'contains', $value);
$jsonQO->from('vacancy')->get();

but that did not work...

ERROR!

The following is my implementation of the code;

$json_response = '
 
 {
    "data": {
        "timezones": [
            {
                "id": 1,
                "name": "Pacific/Midway",
                "location": "(GMT-11:00) Midway Island"
            },
            {
                "id": 2,
                "name": "US/Samoa",
                "location": "(GMT-11:00) Samoa"
            },
            {
                "id": 3,
                "name": "US/Hawaii",
                "location": "(GMT-10:00) Hawaii"
            },
            {
                "id": 4,
                "name": "US/Alaska",
                "location": "(GMT-09:00) Alaska"
            },
            {
                "id": 5,
                "name": "US/Pacific",
                "location": "(GMT-08:00) Pacific Time (US &amp; Canada)"
            },
            {
                "id": 6,
                "name": "America/Tijuana",
                "location": "(GMT-08:00) Tijuana"
            },
            {
                "id": 7,
                "name": "US/Arizona",
                "location": "(GMT-07:00) Arizona"
            },
            {
                "id": 8,
                "name": "US/Mountain",
                "location": "(GMT-07:00) Mountain Time (US &amp; Canada)"
            },
            {
                "id": 9,
                "name": "America/Chihuahua",
                "location": "(GMT-07:00) Chihuahua"
            },
            {
                "id": 10,
                "name": "America/Mazatlan",
                "location": "(GMT-07:00) Mazatlan"
            },
            {
                "id": 11,
                "name": "America/Mexico_City",
                "location": "(GMT-06:00) Mexico City"
            },
            {
                "id": 12,
                "name": "America/Monterrey",
                "location": "(GMT-06:00) Monterrey"
            },
            {
                "id": 13,
                "name": "Canada/Saskatchewan",
                "location": "(GMT-06:00) Saskatchewan"
            },
            {
                "id": 14,
                "name": "US/Central",
                "location": "(GMT-06:00) Central Time (US &amp; Canada)"
            },
            {
                "id": 15,
                "name": "US/Eastern",
                "location": "(GMT-05:00) Eastern Time (US &amp; Canada)"
            },
            {
                "id": 16,
                "name": "US/East-Indiana",
                "location": "(GMT-05:00) Indiana (East)"
            },
            {
                "id": 17,
                "name": "America/Bogota",
                "location": "(GMT-05:00) Bogota"
            },
            {
                "id": 18,
                "name": "America/Lima",
                "location": "(GMT-05:00) Lima"
            },
            {
                "id": 19,
                "name": "America/Caracas",
                "location": "(GMT-04:30) Caracas"
            },
            {
                "id": 20,
                "name": "Canada/Atlantic",
                "location": "(GMT-04:00) Atlantic Time (Canada)"
            },
            {
                "id": 21,
                "name": "America/La_Paz",
                "location": "(GMT-04:00) La Paz"
            },
            {
                "id": 22,
                "name": "America/Santiago",
                "location": "(GMT-04:00) Santiago"
            },
            {
                "id": 23,
                "name": "Canada/Newfoundland",
                "location": "(GMT-03:30) Newfoundland"
            },
            {
                "id": 24,
                "name": "America/Buenos_Aires",
                "location": "(GMT-03:00) Buenos Aires"
            },
            {
                "id": 25,
                "name": "America/Godthab",
                "location": "(GMT-03:00) Greenland"
            },
            {
                "id": 26,
                "name": "Atlantic/Stanley",
                "location": "(GMT-02:00) Stanley"
            },
            {
                "id": 27,
                "name": "Atlantic/Azores",
                "location": "(GMT-01:00) Azores"
            },
            {
                "id": 28,
                "name": "Atlantic/Cape_Verde",
                "location": "(GMT-01:00) Cape Verde Is."
            },
            {
                "id": 29,
                "name": "Africa/Casablanca",
                "location": "(GMT) Casablanca"
            },
            {
                "id": 30,
                "name": "Europe/Dublin",
                "location": "(GMT) Dublin"
            },
            {
                "id": 31,
                "name": "Europe/Lisbon",
                "location": "(GMT) Lisbon"
            },
            {
                "id": 32,
                "name": "Europe/London",
                "location": "(GMT) London"
            },
            {
                "id": 33,
                "name": "Africa/Monrovia",
                "location": "(GMT) Monrovia"
            },
            {
                "id": 34,
                "name": "Europe/Amsterdam",
                "location": "(GMT+01:00) Amsterdam"
            },
            {
                "id": 35,
                "name": "Europe/Belgrade",
                "location": "(GMT+01:00) Belgrade"
            },
            {
                "id": 36,
                "name": "Europe/Berlin",
                "location": "(GMT+01:00) Berlin"
            },
            {
                "id": 37,
                "name": "Europe/Bratislava",
                "location": "(GMT+01:00) Bratislava"
            },
            {
                "id": 38,
                "name": "Europe/Brussels",
                "location": "(GMT+01:00) Brussels"
            },
            {
                "id": 39,
                "name": "Europe/Budapest",
                "location": "(GMT+01:00) Budapest"
            },
            {
                "id": 40,
                "name": "Europe/Copenhagen",
                "location": "(GMT+01:00) Copenhagen"
            },
            {
                "id": 41,
                "name": "Europe/Ljubljana",
                "location": "(GMT+01:00) Ljubljana"
            },
            {
                "id": 42,
                "name": "Europe/Madrid",
                "location": "(GMT+01:00) Madrid"
            },
            {
                "id": 43,
                "name": "Europe/Paris",
                "location": "(GMT+01:00) Paris"
            },
            {
                "id": 44,
                "name": "Europe/Prague",
                "location": "(GMT+01:00) Prague"
            },
            {
                "id": 45,
                "name": "Europe/Rome",
                "location": "(GMT+01:00) Rome"
            },
            {
                "id": 46,
                "name": "Europe/Sarajevo",
                "location": "(GMT+01:00) Sarajevo"
            },
            {
                "id": 47,
                "name": "Europe/Skopje",
                "location": "(GMT+01:00) Skopje"
            },
            {
                "id": 48,
                "name": "Europe/Stockholm",
                "location": "(GMT+01:00) Stockholm"
            },
            {
                "id": 49,
                "name": "Europe/Vienna",
                "location": "(GMT+01:00) Vienna"
            },
            {
                "id": 50,
                "name": "Europe/Warsaw",
                "location": "(GMT+01:00) Warsaw"
            },
            {
                "id": 51,
                "name": "Europe/Zagreb",
                "location": "(GMT+01:00) Zagreb"
            },
            {
                "id": 52,
                "name": "Europe/Athens",
                "location": "(GMT+02:00) Athens"
            },
            {
                "id": 53,
                "name": "Europe/Bucharest",
                "location": "(GMT+02:00) Bucharest"
            },
            {
                "id": 54,
                "name": "Africa/Cairo",
                "location": "(GMT+02:00) Cairo"
            },
            {
                "id": 55,
                "name": "Africa/Harare",
                "location": "(GMT+02:00) Harare"
            },
            {
                "id": 56,
                "name": "Europe/Helsinki",
                "location": "(GMT+02:00) Helsinki"
            },
            {
                "id": 57,
                "name": "Europe/Istanbul",
                "location": "(GMT+02:00) Istanbul"
            },
            {
                "id": 58,
                "name": "Asia/Jerusalem",
                "location": "(GMT+02:00) Jerusalem"
            },
            {
                "id": 59,
                "name": "Europe/Kiev",
                "location": "(GMT+02:00) Kyiv"
            },
            {
                "id": 60,
                "name": "Europe/Minsk",
                "location": "(GMT+02:00) Minsk"
            },
            {
                "id": 61,
                "name": "Europe/Riga",
                "location": "(GMT+02:00) Riga"
            },
            {
                "id": 62,
                "name": "Europe/Sofia",
                "location": "(GMT+02:00) Sofia"
            },
            {
                "id": 63,
                "name": "Europe/Tallinn",
                "location": "(GMT+02:00) Tallinn"
            },
            {
                "id": 64,
                "name": "Europe/Vilnius",
                "location": "(GMT+02:00) Vilnius"
            },
            {
                "id": 65,
                "name": "Asia/Baghdad",
                "location": "(GMT+03:00) Baghdad"
            },
            {
                "id": 66,
                "name": "Asia/Kuwait",
                "location": "(GMT+03:00) Kuwait"
            },
            {
                "id": 67,
                "name": "Africa/Nairobi",
                "location": "(GMT+03:00) Nairobi"
            },
            {
                "id": 68,
                "name": "Asia/Riyadh",
                "location": "(GMT+03:00) Riyadh"
            },
            {
                "id": 69,
                "name": "Asia/Tehran",
                "location": "(GMT+03:30) Tehran"
            },
            {
                "id": 70,
                "name": "Europe/Moscow",
                "location": "(GMT+04:00) Moscow"
            },
            {
                "id": 71,
                "name": "Asia/Baku",
                "location": "(GMT+04:00) Baku"
            },
            {
                "id": 72,
                "name": "Europe/Volgograd",
                "location": "(GMT+04:00) Volgograd"
            },
            {
                "id": 73,
                "name": "Asia/Muscat",
                "location": "(GMT+04:00) Muscat"
            },
            {
                "id": 74,
                "name": "Asia/Tbilisi",
                "location": "(GMT+04:00) Tbilisi"
            },
            {
                "id": 75,
                "name": "Asia/Yerevan",
                "location": "(GMT+04:00) Yerevan"
            },
            {
                "id": 76,
                "name": "Asia/Kabul",
                "location": "(GMT+04:30) Kabul"
            },
            {
                "id": 77,
                "name": "Asia/Karachi",
                "location": "(GMT+05:00) Karachi"
            },
            {
                "id": 78,
                "name": "Asia/Tashkent",
                "location": "(GMT+05:00) Tashkent"
            },
            {
                "id": 79,
                "name": "Asia/Kolkata",
                "location": "(GMT+05:30) Kolkata"
            },
            {
                "id": 80,
                "name": "Asia/Kathmandu",
                "location": "(GMT+05:45) Kathmandu"
            },
            {
                "id": 81,
                "name": "Asia/Yekaterinburg",
                "location": "(GMT+06:00) Ekaterinburg"
            },
            {
                "id": 82,
                "name": "Asia/Almaty",
                "location": "(GMT+06:00) Almaty"
            },
            {
                "id": 83,
                "name": "Asia/Dhaka",
                "location": "(GMT+06:00) Dhaka"
            },
            {
                "id": 84,
                "name": "Asia/Novosibirsk",
                "location": "(GMT+07:00) Novosibirsk"
            },
            {
                "id": 85,
                "name": "Asia/Bangkok",
                "location": "(GMT+07:00) Bangkok"
            },
            {
                "id": 86,
                "name": "Asia/Ho_Chi_Minh",
                "location": "(GMT+07.00) Ho Chi Minh"
            },
            {
                "id": 87,
                "name": "Asia/Jakarta",
                "location": "(GMT+07:00) Jakarta"
            },
            {
                "id": 88,
                "name": "Asia/Krasnoyarsk",
                "location": "(GMT+08:00) Krasnoyarsk"
            },
            {
                "id": 89,
                "name": "Asia/Chongqing",
                "location": "(GMT+08:00) Chongqing"
            },
            {
                "id": 90,
                "name": "Asia/Hong_Kong",
                "location": "(GMT+08:00) Hong Kong"
            },
            {
                "id": 91,
                "name": "Asia/Kuala_Lumpur",
                "location": "(GMT+08:00) Kuala Lumpur"
            },
            {
                "id": 92,
                "name": "Australia/Perth",
                "location": "(GMT+08:00) Perth"
            },
            {
                "id": 93,
                "name": "Asia/Singapore",
                "location": "(GMT+08:00) Singapore"
            },
            {
                "id": 94,
                "name": "Asia/Taipei",
                "location": "(GMT+08:00) Taipei"
            },
            {
                "id": 95,
                "name": "Asia/Ulaanbaatar",
                "location": "(GMT+08:00) Ulaan Bataar"
            },
            {
                "id": 96,
                "name": "Asia/Urumqi",
                "location": "(GMT+08:00) Urumqi"
            },
            {
                "id": 97,
                "name": "Asia/Irkutsk",
                "location": "(GMT+09:00) Irkutsk"
            },
            {
                "id": 98,
                "name": "Asia/Seoul",
                "location": "(GMT+09:00) Seoul"
            },
            {
                "id": 99,
                "name": "Asia/Tokyo",
                "location": "(GMT+09:00) Tokyo"
            },
            {
                "id": 100,
                "name": "Australia/Adelaide",
                "location": "(GMT+09:30) Adelaide"
            },
            {
                "id": 101,
                "name": "Australia/Darwin",
                "location": "(GMT+09:30) Darwin"
            },
            {
                "id": 102,
                "name": "Asia/Yakutsk",
                "location": "(GMT+10:00) Yakutsk"
            },
            {
                "id": 103,
                "name": "Australia/Brisbane",
                "location": "(GMT+10:00) Brisbane"
            },
            {
                "id": 104,
                "name": "Australia/Canberra",
                "location": "(GMT+10:00) Canberra"
            },
            {
                "id": 105,
                "name": "Pacific/Guam",
                "location": "(GMT+10:00) Guam"
            },
            {
                "id": 106,
                "name": "Australia/Hobart",
                "location": "(GMT+10:00) Hobart"
            },
            {
                "id": 107,
                "name": "Australia/Melbourne",
                "location": "(GMT+10:00) Melbourne"
            },
            {
                "id": 108,
                "name": "Pacific/Port_Moresby",
                "location": "(GMT+10:00) Port Moresby"
            },
            {
                "id": 109,
                "name": "Australia/Sydney",
                "location": "(GMT+10:00) Sydney"
            },
            {
                "id": 110,
                "name": "Asia/Vladivostok",
                "location": "(GMT+11:00) Vladivostok"
            },
            {
                "id": 111,
                "name": "Asia/Magadan",
                "location": "(GMT+12:00) Magadan"
            },
            {
                "id": 112,
                "name": "Pacific/Auckland",
                "location": "(GMT+12:00) Auckland"
            },
            {
                "id": 113,
                "name": "Pacific/Fiji",
                "location": "(GMT+12:00) Fiji"
            }
        ],
        "countries": [
            {
                "id": 4,
                "iso_3166_2": "AF",
                "iso_3166_3": "AFG",
                "name": "Afghanistan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 248,
                "iso_3166_2": "AX",
                "iso_3166_3": "ALA",
                "name": "Åland Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 8,
                "iso_3166_2": "AL",
                "iso_3166_3": "ALB",
                "name": "Albania",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 12,
                "iso_3166_2": "DZ",
                "iso_3166_3": "DZA",
                "name": "Algeria",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 16,
                "iso_3166_2": "AS",
                "iso_3166_3": "ASM",
                "name": "American Samoa",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 20,
                "iso_3166_2": "AD",
                "iso_3166_3": "AND",
                "name": "Andorra",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 24,
                "iso_3166_2": "AO",
                "iso_3166_3": "AGO",
                "name": "Angola",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 660,
                "iso_3166_2": "AI",
                "iso_3166_3": "AIA",
                "name": "Anguilla",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 10,
                "iso_3166_2": "AQ",
                "iso_3166_3": "ATA",
                "name": "Antarctica",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 28,
                "iso_3166_2": "AG",
                "iso_3166_3": "ATG",
                "name": "Antigua and Barbuda",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 32,
                "iso_3166_2": "AR",
                "iso_3166_3": "ARG",
                "name": "Argentina",
                "swap_postal_code": true,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 51,
                "iso_3166_2": "AM",
                "iso_3166_3": "ARM",
                "name": "Armenia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 533,
                "iso_3166_2": "AW",
                "iso_3166_3": "ABW",
                "name": "Aruba",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 36,
                "iso_3166_2": "AU",
                "iso_3166_3": "AUS",
                "name": "Australia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 40,
                "iso_3166_2": "AT",
                "iso_3166_3": "AUT",
                "name": "Austria",
                "swap_postal_code": true,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 31,
                "iso_3166_2": "AZ",
                "iso_3166_3": "AZE",
                "name": "Azerbaijan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 44,
                "iso_3166_2": "BS",
                "iso_3166_3": "BHS",
                "name": "Bahamas",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 48,
                "iso_3166_2": "BH",
                "iso_3166_3": "BHR",
                "name": "Bahrain",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 50,
                "iso_3166_2": "BD",
                "iso_3166_3": "BGD",
                "name": "Bangladesh",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 52,
                "iso_3166_2": "BB",
                "iso_3166_3": "BRB",
                "name": "Barbados",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 112,
                "iso_3166_2": "BY",
                "iso_3166_3": "BLR",
                "name": "Belarus",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 56,
                "iso_3166_2": "BE",
                "iso_3166_3": "BEL",
                "name": "Belgium",
                "swap_postal_code": true,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 84,
                "iso_3166_2": "BZ",
                "iso_3166_3": "BLZ",
                "name": "Belize",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 204,
                "iso_3166_2": "BJ",
                "iso_3166_3": "BEN",
                "name": "Benin",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 60,
                "iso_3166_2": "BM",
                "iso_3166_3": "BMU",
                "name": "Bermuda",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 64,
                "iso_3166_2": "BT",
                "iso_3166_3": "BTN",
                "name": "Bhutan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 68,
                "iso_3166_2": "BO",
                "iso_3166_3": "BOL",
                "name": "Bolivia, Plurinational State of",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 535,
                "iso_3166_2": "BQ",
                "iso_3166_3": "BES",
                "name": "Bonaire, Sint Eustatius and Saba",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 70,
                "iso_3166_2": "BA",
                "iso_3166_3": "BIH",
                "name": "Bosnia and Herzegovina",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 72,
                "iso_3166_2": "BW",
                "iso_3166_3": "BWA",
                "name": "Botswana",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 74,
                "iso_3166_2": "BV",
                "iso_3166_3": "BVT",
                "name": "Bouvet Island",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 76,
                "iso_3166_2": "BR",
                "iso_3166_3": "BRA",
                "name": "Brazil",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 86,
                "iso_3166_2": "IO",
                "iso_3166_3": "IOT",
                "name": "British Indian Ocean Territory",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 96,
                "iso_3166_2": "BN",
                "iso_3166_3": "BRN",
                "name": "Brunei Darussalam",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 100,
                "iso_3166_2": "BG",
                "iso_3166_3": "BGR",
                "name": "Bulgaria",
                "swap_postal_code": false,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 854,
                "iso_3166_2": "BF",
                "iso_3166_3": "BFA",
                "name": "Burkina Faso",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 108,
                "iso_3166_2": "BI",
                "iso_3166_3": "BDI",
                "name": "Burundi",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 116,
                "iso_3166_2": "KH",
                "iso_3166_3": "KHM",
                "name": "Cambodia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 120,
                "iso_3166_2": "CM",
                "iso_3166_3": "CMR",
                "name": "Cameroon",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 124,
                "iso_3166_2": "CA",
                "iso_3166_3": "CAN",
                "name": "Canada",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": ",",
                "decimal_separator": "."
            },
            {
                "id": 132,
                "iso_3166_2": "CV",
                "iso_3166_3": "CPV",
                "name": "Cape Verde",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 136,
                "iso_3166_2": "KY",
                "iso_3166_3": "CYM",
                "name": "Cayman Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 140,
                "iso_3166_2": "CF",
                "iso_3166_3": "CAF",
                "name": "Central African Republic",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 148,
                "iso_3166_2": "TD",
                "iso_3166_3": "TCD",
                "name": "Chad",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 152,
                "iso_3166_2": "CL",
                "iso_3166_3": "CHL",
                "name": "Chile",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 156,
                "iso_3166_2": "CN",
                "iso_3166_3": "CHN",
                "name": "China",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 162,
                "iso_3166_2": "CX",
                "iso_3166_3": "CXR",
                "name": "Christmas Island",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 166,
                "iso_3166_2": "CC",
                "iso_3166_3": "CCK",
                "name": "Cocos (Keeling) Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 170,
                "iso_3166_2": "CO",
                "iso_3166_3": "COL",
                "name": "Colombia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 174,
                "iso_3166_2": "KM",
                "iso_3166_3": "COM",
                "name": "Comoros",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 178,
                "iso_3166_2": "CG",
                "iso_3166_3": "COG",
                "name": "Congo",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 180,
                "iso_3166_2": "CD",
                "iso_3166_3": "COD",
                "name": "Congo, the Democratic Republic of the",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 184,
                "iso_3166_2": "CK",
                "iso_3166_3": "COK",
                "name": "Cook Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 188,
                "iso_3166_2": "CR",
                "iso_3166_3": "CRI",
                "name": "Costa Rica",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 384,
                "iso_3166_2": "CI",
                "iso_3166_3": "CIV",
                "name": "Côte d'Ivoire",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 191,
                "iso_3166_2": "HR",
                "iso_3166_3": "HRV",
                "name": "Croatia",
                "swap_postal_code": false,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 192,
                "iso_3166_2": "CU",
                "iso_3166_3": "CUB",
                "name": "Cuba",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 531,
                "iso_3166_2": "CW",
                "iso_3166_3": "CUW",
                "name": "Curaçao",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 196,
                "iso_3166_2": "CY",
                "iso_3166_3": "CYP",
                "name": "Cyprus",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 203,
                "iso_3166_2": "CZ",
                "iso_3166_3": "CZE",
                "name": "Czech Republic",
                "swap_postal_code": false,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 208,
                "iso_3166_2": "DK",
                "iso_3166_3": "DNK",
                "name": "Denmark",
                "swap_postal_code": true,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 262,
                "iso_3166_2": "DJ",
                "iso_3166_3": "DJI",
                "name": "Djibouti",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 212,
                "iso_3166_2": "DM",
                "iso_3166_3": "DMA",
                "name": "Dominica",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 214,
                "iso_3166_2": "DO",
                "iso_3166_3": "DOM",
                "name": "Dominican Republic",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 218,
                "iso_3166_2": "EC",
                "iso_3166_3": "ECU",
                "name": "Ecuador",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 818,
                "iso_3166_2": "EG",
                "iso_3166_3": "EGY",
                "name": "Egypt",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 222,
                "iso_3166_2": "SV",
                "iso_3166_3": "SLV",
                "name": "El Salvador",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 226,
                "iso_3166_2": "GQ",
                "iso_3166_3": "GNQ",
                "name": "Equatorial Guinea",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 232,
                "iso_3166_2": "ER",
                "iso_3166_3": "ERI",
                "name": "Eritrea",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 233,
                "iso_3166_2": "EE",
                "iso_3166_3": "EST",
                "name": "Estonia",
                "swap_postal_code": false,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 231,
                "iso_3166_2": "ET",
                "iso_3166_3": "ETH",
                "name": "Ethiopia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 238,
                "iso_3166_2": "FK",
                "iso_3166_3": "FLK",
                "name": "Falkland Islands (Malvinas)",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 234,
                "iso_3166_2": "FO",
                "iso_3166_3": "FRO",
                "name": "Faroe Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 242,
                "iso_3166_2": "FJ",
                "iso_3166_3": "FJI",
                "name": "Fiji",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 246,
                "iso_3166_2": "FI",
                "iso_3166_3": "FIN",
                "name": "Finland",
                "swap_postal_code": true,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 250,
                "iso_3166_2": "FR",
                "iso_3166_3": "FRA",
                "name": "France",
                "swap_postal_code": true,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 254,
                "iso_3166_2": "GF",
                "iso_3166_3": "GUF",
                "name": "French Guiana",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 258,
                "iso_3166_2": "PF",
                "iso_3166_3": "PYF",
                "name": "French Polynesia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 260,
                "iso_3166_2": "TF",
                "iso_3166_3": "ATF",
                "name": "French Southern Territories",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 266,
                "iso_3166_2": "GA",
                "iso_3166_3": "GAB",
                "name": "Gabon",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 270,
                "iso_3166_2": "GM",
                "iso_3166_3": "GMB",
                "name": "Gambia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 268,
                "iso_3166_2": "GE",
                "iso_3166_3": "GEO",
                "name": "Georgia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 276,
                "iso_3166_2": "DE",
                "iso_3166_3": "DEU",
                "name": "Germany",
                "swap_postal_code": true,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 288,
                "iso_3166_2": "GH",
                "iso_3166_3": "GHA",
                "name": "Ghana",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 292,
                "iso_3166_2": "GI",
                "iso_3166_3": "GIB",
                "name": "Gibraltar",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 300,
                "iso_3166_2": "GR",
                "iso_3166_3": "GRC",
                "name": "Greece",
                "swap_postal_code": false,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 304,
                "iso_3166_2": "GL",
                "iso_3166_3": "GRL",
                "name": "Greenland",
                "swap_postal_code": true,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 308,
                "iso_3166_2": "GD",
                "iso_3166_3": "GRD",
                "name": "Grenada",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 312,
                "iso_3166_2": "GP",
                "iso_3166_3": "GLP",
                "name": "Guadeloupe",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 316,
                "iso_3166_2": "GU",
                "iso_3166_3": "GUM",
                "name": "Guam",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 320,
                "iso_3166_2": "GT",
                "iso_3166_3": "GTM",
                "name": "Guatemala",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 831,
                "iso_3166_2": "GG",
                "iso_3166_3": "GGY",
                "name": "Guernsey",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 324,
                "iso_3166_2": "GN",
                "iso_3166_3": "GIN",
                "name": "Guinea",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 624,
                "iso_3166_2": "GW",
                "iso_3166_3": "GNB",
                "name": "Guinea-Bissau",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 328,
                "iso_3166_2": "GY",
                "iso_3166_3": "GUY",
                "name": "Guyana",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 332,
                "iso_3166_2": "HT",
                "iso_3166_3": "HTI",
                "name": "Haiti",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 334,
                "iso_3166_2": "HM",
                "iso_3166_3": "HMD",
                "name": "Heard Island and McDonald Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 336,
                "iso_3166_2": "VA",
                "iso_3166_3": "VAT",
                "name": "Holy See (Vatican City State)",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 340,
                "iso_3166_2": "HN",
                "iso_3166_3": "HND",
                "name": "Honduras",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 344,
                "iso_3166_2": "HK",
                "iso_3166_3": "HKG",
                "name": "Hong Kong",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 348,
                "iso_3166_2": "HU",
                "iso_3166_3": "HUN",
                "name": "Hungary",
                "swap_postal_code": false,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 352,
                "iso_3166_2": "IS",
                "iso_3166_3": "ISL",
                "name": "Iceland",
                "swap_postal_code": true,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 356,
                "iso_3166_2": "IN",
                "iso_3166_3": "IND",
                "name": "India",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 360,
                "iso_3166_2": "ID",
                "iso_3166_3": "IDN",
                "name": "Indonesia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 364,
                "iso_3166_2": "IR",
                "iso_3166_3": "IRN",
                "name": "Iran, Islamic Republic of",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 368,
                "iso_3166_2": "IQ",
                "iso_3166_3": "IRQ",
                "name": "Iraq",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 372,
                "iso_3166_2": "IE",
                "iso_3166_3": "IRL",
                "name": "Ireland",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": ",",
                "decimal_separator": "."
            },
            {
                "id": 833,
                "iso_3166_2": "IM",
                "iso_3166_3": "IMN",
                "name": "Isle of Man",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 376,
                "iso_3166_2": "IL",
                "iso_3166_3": "ISR",
                "name": "Israel",
                "swap_postal_code": true,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 380,
                "iso_3166_2": "IT",
                "iso_3166_3": "ITA",
                "name": "Italy",
                "swap_postal_code": true,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 388,
                "iso_3166_2": "JM",
                "iso_3166_3": "JAM",
                "name": "Jamaica",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 392,
                "iso_3166_2": "JP",
                "iso_3166_3": "JPN",
                "name": "Japan",
                "swap_postal_code": true,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 832,
                "iso_3166_2": "JE",
                "iso_3166_3": "JEY",
                "name": "Jersey",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 400,
                "iso_3166_2": "JO",
                "iso_3166_3": "JOR",
                "name": "Jordan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 398,
                "iso_3166_2": "KZ",
                "iso_3166_3": "KAZ",
                "name": "Kazakhstan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 404,
                "iso_3166_2": "KE",
                "iso_3166_3": "KEN",
                "name": "Kenya",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 296,
                "iso_3166_2": "KI",
                "iso_3166_3": "KIR",
                "name": "Kiribati",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 408,
                "iso_3166_2": "KP",
                "iso_3166_3": "PRK",
                "name": "Korea, Democratic People's Republic of",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 410,
                "iso_3166_2": "KR",
                "iso_3166_3": "KOR",
                "name": "Korea, Republic of",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 414,
                "iso_3166_2": "KW",
                "iso_3166_3": "KWT",
                "name": "Kuwait",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 417,
                "iso_3166_2": "KG",
                "iso_3166_3": "KGZ",
                "name": "Kyrgyzstan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 418,
                "iso_3166_2": "LA",
                "iso_3166_3": "LAO",
                "name": "Lao People's Democratic Republic",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 428,
                "iso_3166_2": "LV",
                "iso_3166_3": "LVA",
                "name": "Latvia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 422,
                "iso_3166_2": "LB",
                "iso_3166_3": "LBN",
                "name": "Lebanon",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 426,
                "iso_3166_2": "LS",
                "iso_3166_3": "LSO",
                "name": "Lesotho",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 430,
                "iso_3166_2": "LR",
                "iso_3166_3": "LBR",
                "name": "Liberia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 434,
                "iso_3166_2": "LY",
                "iso_3166_3": "LBY",
                "name": "Libya",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 438,
                "iso_3166_2": "LI",
                "iso_3166_3": "LIE",
                "name": "Liechtenstein",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 440,
                "iso_3166_2": "LT",
                "iso_3166_3": "LTU",
                "name": "Lithuania",
                "swap_postal_code": false,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 442,
                "iso_3166_2": "LU",
                "iso_3166_3": "LUX",
                "name": "Luxembourg",
                "swap_postal_code": true,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 446,
                "iso_3166_2": "MO",
                "iso_3166_3": "MAC",
                "name": "Macao",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 807,
                "iso_3166_2": "MK",
                "iso_3166_3": "MKD",
                "name": "Macedonia, the former Yugoslav Republic of",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 450,
                "iso_3166_2": "MG",
                "iso_3166_3": "MDG",
                "name": "Madagascar",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 454,
                "iso_3166_2": "MW",
                "iso_3166_3": "MWI",
                "name": "Malawi",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 458,
                "iso_3166_2": "MY",
                "iso_3166_3": "MYS",
                "name": "Malaysia",
                "swap_postal_code": true,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 462,
                "iso_3166_2": "MV",
                "iso_3166_3": "MDV",
                "name": "Maldives",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 466,
                "iso_3166_2": "ML",
                "iso_3166_3": "MLI",
                "name": "Mali",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 470,
                "iso_3166_2": "MT",
                "iso_3166_3": "MLT",
                "name": "Malta",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": ",",
                "decimal_separator": "."
            },
            {
                "id": 584,
                "iso_3166_2": "MH",
                "iso_3166_3": "MHL",
                "name": "Marshall Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 474,
                "iso_3166_2": "MQ",
                "iso_3166_3": "MTQ",
                "name": "Martinique",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 478,
                "iso_3166_2": "MR",
                "iso_3166_3": "MRT",
                "name": "Mauritania",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 480,
                "iso_3166_2": "MU",
                "iso_3166_3": "MUS",
                "name": "Mauritius",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 175,
                "iso_3166_2": "YT",
                "iso_3166_3": "MYT",
                "name": "Mayotte",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 484,
                "iso_3166_2": "MX",
                "iso_3166_3": "MEX",
                "name": "Mexico",
                "swap_postal_code": true,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 583,
                "iso_3166_2": "FM",
                "iso_3166_3": "FSM",
                "name": "Micronesia, Federated States of",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 498,
                "iso_3166_2": "MD",
                "iso_3166_3": "MDA",
                "name": "Moldova, Republic of",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 492,
                "iso_3166_2": "MC",
                "iso_3166_3": "MCO",
                "name": "Monaco",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 496,
                "iso_3166_2": "MN",
                "iso_3166_3": "MNG",
                "name": "Mongolia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 499,
                "iso_3166_2": "ME",
                "iso_3166_3": "MNE",
                "name": "Montenegro",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 500,
                "iso_3166_2": "MS",
                "iso_3166_3": "MSR",
                "name": "Montserrat",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 504,
                "iso_3166_2": "MA",
                "iso_3166_3": "MAR",
                "name": "Morocco",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 508,
                "iso_3166_2": "MZ",
                "iso_3166_3": "MOZ",
                "name": "Mozambique",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 104,
                "iso_3166_2": "MM",
                "iso_3166_3": "MMR",
                "name": "Myanmar",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 516,
                "iso_3166_2": "NA",
                "iso_3166_3": "NAM",
                "name": "Namibia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 520,
                "iso_3166_2": "NR",
                "iso_3166_3": "NRU",
                "name": "Nauru",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 524,
                "iso_3166_2": "NP",
                "iso_3166_3": "NPL",
                "name": "Nepal",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 528,
                "iso_3166_2": "NL",
                "iso_3166_3": "NLD",
                "name": "Netherlands",
                "swap_postal_code": true,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 540,
                "iso_3166_2": "NC",
                "iso_3166_3": "NCL",
                "name": "New Caledonia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 554,
                "iso_3166_2": "NZ",
                "iso_3166_3": "NZL",
                "name": "New Zealand",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 558,
                "iso_3166_2": "NI",
                "iso_3166_3": "NIC",
                "name": "Nicaragua",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 562,
                "iso_3166_2": "NE",
                "iso_3166_3": "NER",
                "name": "Niger",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 566,
                "iso_3166_2": "NG",
                "iso_3166_3": "NGA",
                "name": "Nigeria",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 570,
                "iso_3166_2": "NU",
                "iso_3166_3": "NIU",
                "name": "Niue",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 574,
                "iso_3166_2": "NF",
                "iso_3166_3": "NFK",
                "name": "Norfolk Island",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 580,
                "iso_3166_2": "MP",
                "iso_3166_3": "MNP",
                "name": "Northern Mariana Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 578,
                "iso_3166_2": "NO",
                "iso_3166_3": "NOR",
                "name": "Norway",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 512,
                "iso_3166_2": "OM",
                "iso_3166_3": "OMN",
                "name": "Oman",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 586,
                "iso_3166_2": "PK",
                "iso_3166_3": "PAK",
                "name": "Pakistan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 585,
                "iso_3166_2": "PW",
                "iso_3166_3": "PLW",
                "name": "Palau",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 275,
                "iso_3166_2": "PS",
                "iso_3166_3": "PSE",
                "name": "Palestinian Territory, Occupied",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 591,
                "iso_3166_2": "PA",
                "iso_3166_3": "PAN",
                "name": "Panama",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 598,
                "iso_3166_2": "PG",
                "iso_3166_3": "PNG",
                "name": "Papua New Guinea",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 600,
                "iso_3166_2": "PY",
                "iso_3166_3": "PRY",
                "name": "Paraguay",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 604,
                "iso_3166_2": "PE",
                "iso_3166_3": "PER",
                "name": "Peru",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 608,
                "iso_3166_2": "PH",
                "iso_3166_3": "PHL",
                "name": "Philippines",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 612,
                "iso_3166_2": "PN",
                "iso_3166_3": "PCN",
                "name": "Pitcairn",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 616,
                "iso_3166_2": "PL",
                "iso_3166_3": "POL",
                "name": "Poland",
                "swap_postal_code": true,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 620,
                "iso_3166_2": "PT",
                "iso_3166_3": "PRT",
                "name": "Portugal",
                "swap_postal_code": true,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 630,
                "iso_3166_2": "PR",
                "iso_3166_3": "PRI",
                "name": "Puerto Rico",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 634,
                "iso_3166_2": "QA",
                "iso_3166_3": "QAT",
                "name": "Qatar",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 638,
                "iso_3166_2": "RE",
                "iso_3166_3": "REU",
                "name": "Réunion",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 642,
                "iso_3166_2": "RO",
                "iso_3166_3": "ROU",
                "name": "Romania",
                "swap_postal_code": false,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 643,
                "iso_3166_2": "RU",
                "iso_3166_3": "RUS",
                "name": "Russian Federation",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 646,
                "iso_3166_2": "RW",
                "iso_3166_3": "RWA",
                "name": "Rwanda",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 652,
                "iso_3166_2": "BL",
                "iso_3166_3": "BLM",
                "name": "Saint Barthélemy",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 654,
                "iso_3166_2": "SH",
                "iso_3166_3": "SHN",
                "name": "Saint Helena, Ascension and Tristan da Cunha",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 659,
                "iso_3166_2": "KN",
                "iso_3166_3": "KNA",
                "name": "Saint Kitts and Nevis",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 662,
                "iso_3166_2": "LC",
                "iso_3166_3": "LCA",
                "name": "Saint Lucia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 663,
                "iso_3166_2": "MF",
                "iso_3166_3": "MAF",
                "name": "Saint Martin (French part)",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 666,
                "iso_3166_2": "PM",
                "iso_3166_3": "SPM",
                "name": "Saint Pierre and Miquelon",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 670,
                "iso_3166_2": "VC",
                "iso_3166_3": "VCT",
                "name": "Saint Vincent and the Grenadines",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 882,
                "iso_3166_2": "WS",
                "iso_3166_3": "WSM",
                "name": "Samoa",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 674,
                "iso_3166_2": "SM",
                "iso_3166_3": "SMR",
                "name": "San Marino",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 678,
                "iso_3166_2": "ST",
                "iso_3166_3": "STP",
                "name": "Sao Tome and Principe",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 682,
                "iso_3166_2": "SA",
                "iso_3166_3": "SAU",
                "name": "Saudi Arabia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 686,
                "iso_3166_2": "SN",
                "iso_3166_3": "SEN",
                "name": "Senegal",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 688,
                "iso_3166_2": "RS",
                "iso_3166_3": "SRB",
                "name": "Serbia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 690,
                "iso_3166_2": "SC",
                "iso_3166_3": "SYC",
                "name": "Seychelles",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 694,
                "iso_3166_2": "SL",
                "iso_3166_3": "SLE",
                "name": "Sierra Leone",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 702,
                "iso_3166_2": "SG",
                "iso_3166_3": "SGP",
                "name": "Singapore",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 534,
                "iso_3166_2": "SX",
                "iso_3166_3": "SXM",
                "name": "Sint Maarten (Dutch part)",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 703,
                "iso_3166_2": "SK",
                "iso_3166_3": "SVK",
                "name": "Slovakia",
                "swap_postal_code": false,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 705,
                "iso_3166_2": "SI",
                "iso_3166_3": "SVN",
                "name": "Slovenia",
                "swap_postal_code": false,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 90,
                "iso_3166_2": "SB",
                "iso_3166_3": "SLB",
                "name": "Solomon Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 706,
                "iso_3166_2": "SO",
                "iso_3166_3": "SOM",
                "name": "Somalia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 710,
                "iso_3166_2": "ZA",
                "iso_3166_3": "ZAF",
                "name": "South Africa",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 239,
                "iso_3166_2": "GS",
                "iso_3166_3": "SGS",
                "name": "South Georgia and the South Sandwich Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 728,
                "iso_3166_2": "SS",
                "iso_3166_3": "SSD",
                "name": "South Sudan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 724,
                "iso_3166_2": "ES",
                "iso_3166_3": "ESP",
                "name": "Spain",
                "swap_postal_code": true,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 144,
                "iso_3166_2": "LK",
                "iso_3166_3": "LKA",
                "name": "Sri Lanka",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 729,
                "iso_3166_2": "SD",
                "iso_3166_3": "SDN",
                "name": "Sudan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 740,
                "iso_3166_2": "SR",
                "iso_3166_3": "SUR",
                "name": "Suriname",
                "swap_postal_code": false,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 744,
                "iso_3166_2": "SJ",
                "iso_3166_3": "SJM",
                "name": "Svalbard and Jan Mayen",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 748,
                "iso_3166_2": "SZ",
                "iso_3166_3": "SWZ",
                "name": "Swaziland",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 752,
                "iso_3166_2": "SE",
                "iso_3166_3": "SWE",
                "name": "Sweden",
                "swap_postal_code": true,
                "swap_currency_symbol": true,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 756,
                "iso_3166_2": "CH",
                "iso_3166_3": "CHE",
                "name": "Switzerland",
                "swap_postal_code": true,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 760,
                "iso_3166_2": "SY",
                "iso_3166_3": "SYR",
                "name": "Syrian Arab Republic",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 158,
                "iso_3166_2": "TW",
                "iso_3166_3": "TWN",
                "name": "Taiwan, Province of China",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 762,
                "iso_3166_2": "TJ",
                "iso_3166_3": "TJK",
                "name": "Tajikistan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 834,
                "iso_3166_2": "TZ",
                "iso_3166_3": "TZA",
                "name": "Tanzania, United Republic of",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 764,
                "iso_3166_2": "TH",
                "iso_3166_3": "THA",
                "name": "Thailand",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 626,
                "iso_3166_2": "TL",
                "iso_3166_3": "TLS",
                "name": "Timor-Leste",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 768,
                "iso_3166_2": "TG",
                "iso_3166_3": "TGO",
                "name": "Togo",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 772,
                "iso_3166_2": "TK",
                "iso_3166_3": "TKL",
                "name": "Tokelau",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 776,
                "iso_3166_2": "TO",
                "iso_3166_3": "TON",
                "name": "Tonga",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 780,
                "iso_3166_2": "TT",
                "iso_3166_3": "TTO",
                "name": "Trinidad and Tobago",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 788,
                "iso_3166_2": "TN",
                "iso_3166_3": "TUN",
                "name": "Tunisia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 792,
                "iso_3166_2": "TR",
                "iso_3166_3": "TUR",
                "name": "Turkey",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 795,
                "iso_3166_2": "TM",
                "iso_3166_3": "TKM",
                "name": "Turkmenistan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 796,
                "iso_3166_2": "TC",
                "iso_3166_3": "TCA",
                "name": "Turks and Caicos Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 798,
                "iso_3166_2": "TV",
                "iso_3166_3": "TUV",
                "name": "Tuvalu",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 800,
                "iso_3166_2": "UG",
                "iso_3166_3": "UGA",
                "name": "Uganda",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 804,
                "iso_3166_2": "UA",
                "iso_3166_3": "UKR",
                "name": "Ukraine",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 784,
                "iso_3166_2": "AE",
                "iso_3166_3": "ARE",
                "name": "United Arab Emirates",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 826,
                "iso_3166_2": "GB",
                "iso_3166_3": "GBR",
                "name": "United Kingdom",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 840,
                "iso_3166_2": "US",
                "iso_3166_3": "USA",
                "name": "United States",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": ",",
                "decimal_separator": "."
            },
            {
                "id": 581,
                "iso_3166_2": "UM",
                "iso_3166_3": "UMI",
                "name": "United States Minor Outlying Islands",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 858,
                "iso_3166_2": "UY",
                "iso_3166_3": "URY",
                "name": "Uruguay",
                "swap_postal_code": true,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 860,
                "iso_3166_2": "UZ",
                "iso_3166_3": "UZB",
                "name": "Uzbekistan",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 548,
                "iso_3166_2": "VU",
                "iso_3166_3": "VUT",
                "name": "Vanuatu",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 862,
                "iso_3166_2": "VE",
                "iso_3166_3": "VEN",
                "name": "Venezuela, Bolivarian Republic of",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 704,
                "iso_3166_2": "VN",
                "iso_3166_3": "VNM",
                "name": "Viet Nam",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 92,
                "iso_3166_2": "VG",
                "iso_3166_3": "VGB",
                "name": "Virgin Islands, British",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 850,
                "iso_3166_2": "VI",
                "iso_3166_3": "VIR",
                "name": "Virgin Islands, U.S.",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 876,
                "iso_3166_2": "WF",
                "iso_3166_3": "WLF",
                "name": "Wallis and Futuna",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 732,
                "iso_3166_2": "EH",
                "iso_3166_3": "ESH",
                "name": "Western Sahara",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 887,
                "iso_3166_2": "YE",
                "iso_3166_3": "YEM",
                "name": "Yemen",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 894,
                "iso_3166_2": "ZM",
                "iso_3166_3": "ZMB",
                "name": "Zambia",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            },
            {
                "id": 716,
                "iso_3166_2": "ZW",
                "iso_3166_3": "ZWE",
                "name": "Zimbabwe",
                "swap_postal_code": false,
                "swap_currency_symbol": false,
                "thousand_separator": null,
                "decimal_separator": null
            }
        ]
    }
}
 
';

$ISOAlpha2Code = "US";
$jsonq = new jsonq();
$jsonq->json($json_response);
$res = $jsonq->from('countries')
	->where('iso_3166_2', '=', $ISOAlpha2Code)
	->first();

var_dump($res);


But i get the following error:-

ErrorException  : array_key_exists() expects parameter 2 to be array, null given

 at /project/vendor/nahid/jsonq/src/JsonQueriable.php:321
   317|             $terminate = false;
   318|             $path = explode('.', $node);
   319|
   320|             foreach ($path as $val) {
 > 321|                 if (!array_key_exists($val, $map)) {
   322|                     $terminate = true;
   323|                     break;
   324|                 }
   325|

 Exception trace:

 1   array_key_exists("countries")
     /project/vendor/nahid/jsonq/src/JsonQueriable.php:321

 2   Nahid\JsonQ\Jsonq::getFromNested("countries")
     /project/vendor/nahid/jsonq/src/JsonQueriable.php:346


What is the problem?

Call to undefined method Nahid\JsonQ\Jsonq::groupBy()

Hi, I'm using JsonQ on Laravel 5.4. I followed the steps:
1.- run $composer require nahid/jsonq
2.- Add "use "Nahid\JsonQ\Jsonq;" to controller
The next code shows that error:

$jsonq = new Jsonq();
$json = $jsonq->json('{"users":[{"name":"Name1","email":"[email protected]","type":"1"},{"name":"Name2","email":"[email protected]","type":"2"}]}');
$types = $json->from('users')->groupBy('type')->get();

I've tested other library functions, and they work fine, but it does not work when I use groupBy()

'from' method can be renamed to 'at'

@s1s1ty apu had a problem implementing 'from' as a method name in her python implementation because it's a reserved word in python. We discussed and agreed that it can be renamed to 'at' and it seems quite good enough and meaningful. You can consider it.

Making nested aggregations to compare student result into materials through multiple months

@nahid
################ Json Data 1 ######################
{
"student_results": [
{
"month": "month1",
"results": [
{
"material_code": "Math",
"result": "20",
},
{
"material_code": "English",
"result": "50",
},
]
}
]
}

################ Json Data 2 ######################
{
"student_results": [
{
"month": "month2",
"results": [
{
"material_code": "Math",
"result": "30",
},
{
"material_code": "English",
"result": "48",
},
]
}
]
}

################ Expected result ######################

{
"student_results": [
{
"month": "month2",
"results": [
{
"material_code": "Math",
"result": "30",
},
{
"material_code": "English",
"result": "50",
},
]
}
]
}

Combining multiple OrWhere to one result in AND

I am working on a filter page, and I was wondering if we could combine all filters in one category like this:

If I search for 'lorum ipsum' in title and in intro and in content, if its found in any of those 3 then its a hit for that search, but I also like to see if node: specialty is 1 or 2 or 3 (than can easily be done by using whereIN.) and then I like to search in my custom macro and if that is also true then return that item.

so a hit should have ( 'lorum ipsum' in title OR 'lorum ipsum' in intro OR 'lorum ipsum' in content) AND (1 OR 2 OR 3 IN specialty) AND macro IS true.

Is this possible?

Beerpay link is broken

Just wanted to thank you for your awesome work with a lil donation, but Beerpay tells me your api key has expired.

Can't get whereIn to work

I'm trying to filter on a key that returns an array of colours, but I can't get it to work.
Example of data:

$result = Array
(
    [0] => Array
        (
            [Art nr] => 2094
        )

    [1] => Array
        (
            [Art nr] => 0480C
        )

    [2] => Array
        (
            [Art nr] => 1576
        )

    [3] => Array
        (
            [Art nr] => 2619
            [Colour (website)] => Array
                (
                    [0] => Brown
                )
        )

    [4] => Array
        (
            [Art nr] => 1449
        )

    [5] => Array
        (
            [Art nr] => 3252
        )

    [6] => Array
        (
            [Art nr] => 2618
            [Colour (website)] => Array
                (
                    [0] => Brown
                )
        )

    [7] => Array
        (
            [Art nr] => 3029
            [Colour (website)] => Array
                (
                    [0] => Brown
                )
        )
)

My code:

$jsonq = new Jsonq();
$jsonq->json(json_encode($result));
$res = $jsonq
	->whereIn("Brown", "Colour (website)")
	->get();
write_log($res);

But I get an empty array as a result.
I also tried switching the key and value in the command, like whereIn("Colour (website)", "Brown"), but without result.

Another thing I tried is converting the colour field to json, so it becomes a 'flatter array' like this: [colour_website] => ["Brown"] but that also doesn't work.

What am I doing wrong?

array_key_exists() expects parameter 2 to be array, string given

Hello,

I seem to have trouble using this library correctly. My goal is to use it as a JSON query tool on a directory of equal or different structured JSON files. Therefore I most likely do not have a huge json with a collection of data available.

Further I just want to get back a TRUE or the wohle object when my conditions are match. With my trys I get always the error message from the issue title.

Simple example from the readme.md:

$q = new Jsonq();
$q->collect(['id'=>1, 'name'=>'Nahid']);
$res = $q->where('name', '=', "Nahid")->get();

or

$q = new Jsonq('data.json'); // data from the README.md
$res = $q->where('name', '=', "products")->get();

When I try something else it returns empty even though I can see that it should match.

$q = new Jsonq();
$q->collect(['foo' => ['id'=>1, 'name'=>'Nahid']]);
$res = $q->where('foo.name', '=', "Nahid")->get();
// $res is empty array

Full Error:
array_key_exists() expects parameter 2 to be array, string given
...\nahid\jsonq\src\JsonQueriable.php:334
...\nahid\jsonq\src\JsonQueriable.php:386
...\nahid\jsonq\src\JsonQueriable.php:393
...\nahid\jsonq\src\JsonQueriable.php:125
...\nahid\jsonq\src\Jsonq.php:120

Getting error on Multidimensional array search

This is my json array

[
  {
    "name": "post11",
    "type": "fields",
    "fields": [
      {
        "name": "background_color",
        "type": "select",
        "options": {
          "rules": "required",
          "value": "#FFFFFF",
          "wrapper": {
            "class": "col-md-6"
          },
          "choices": {
            "#ECECEC": "Grey",
            "#FFFFFF": "White"
          },
          "selected": "#ECECEC",
          "content_type": "select",
          "error_messages": {
            "background_color.required": "Background Color is mandatory."
          }
        }
      },
      {
        "name": "post1_title",
        "type": "text",
        "options": {
          "wrapper": {
            "class": "col-md-6"
          },
          "value": "",
          "rules": "required",
          "content_type": "text"
        }
      }
    ]
  },
  {
    "name": "post12",
    "type": "fields",
    "fields": [
      {
        "name": "post1",
        "type": "textarea",
        "options": {
          "wrapper": {
            "class": "col-md-6"
          },
          "rules": "required|min:5",
          "value": "",
          "content_type": "textarea",
          "error_messages": {
            "post1.required": "Post1 is mandatory."
          }
        }
      },
      {
        "name": "modal1_view",
        "type": "textarea",
        "options": {
          "wrapper": {
            "class": "col-md-6"
          },
        "content_type": "editor",
        "attr": {
          "class": "form-control editor"
        },
          "value": ""
        }
      }
    ]
  },
  {
    "name": "post13",
    "type": "fields",
    "fields": [
      {
        "name": "internal1_url",
        "type": "text",
        "options": {
          "wrapper": {
            "class": "col-md-6"
          },
          "value": "",
          "content_type": "text"
        }
      },
      {
        "name": "image1",
        "type": "file",
        "options": {
          "wrapper": {
            "class": "col-md-6"
          },
          "value": "",
          "content_type": "text"
        }
      }
    ]
  },
  {
    "attr": {
      "class": "btn btn-primary pull-right"
    },
    "name": "submit",
    "type": "submit"
  }
]

I need to search content_type = editor.

$jsonq->from("fields")->where("content_type", "=", "select")->get();

But I'm getting

ErrorException
array_filter() expects parameter 1 to be array, object given

How can I fix it?

Is this still supported?

I tried cloning the repo into my PHP project but getting error "Parse error: syntax error, unexpected '/', expecting ';' or ',' " when using "use Nahid/JsonQ/Jsonq;"

foreach() to retrieve records only working once

Hi, I'm trying to loop through an array of ids and return some corresponding records, something like this...

foreach (['recHg30ki6MeYP40s','recvtmtL2umW0fDzT'] as $attr){
	$item = $items->from('rows')->where('id', '=', $attr)->get();
	print_r($item);
}

It outputs the array correctly in the first loop, but second (or more) loop return nothing and the following warning:

Warning:  array_filter() expects parameter 1 to be array, object given in /Users/.../vendor/nahid/jsonq/src/JsonQueriable.php on line 393

Any thoughts? Could it be something to do with pointers?

DISTINCT available??

->select('id', DISTINCT( 'type'),'performed','requested','status','last_action_performed_at')

PHP deprecated

PHP Deprecated: is_file(): Passing null to parameter #1 ($filename) of type string is deprecated in .../vendor/nahid/qarray/src/QueryEngine.php on line 19

Could you fix this and fully support the PHP 8.*?

Function in where() clause isn't working

How do I use function in ->where() ?
I was trying to convert a string to date with strtotime() and compare with a date but it isn't working.
Can anyone please help me?

$date_end = '02/05/2018';
$getdata = $q->collect($json_decoded_data)
    ->from('disclosures')
    ->where(strtotime('eventDate'), '>', strtotime($date_end))
    ->fetch();

Solution: thanks to @nahid

try this
$q->macro('dateGt', function($val, $comp) {
    $date_split = explode('/', $val);
    $date_format = $date_split[2]. '-' . $date_split[0] . '-' . $date_split[1];
    $comp = strtotime($comp);
    $date = strtotime($date_format);
    return $date > $comp;
});

$res = $q
    ->from('disclosures')
    ->where('eventDate', 'dateGt', '2018-07-02')
    ->get();

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.