Additional info in JSON for jQuery dataTable plugin - jquery-plugins

jQuery dataTable plugin expects the data (aaData) in a format where aaData is an array of array.Like below
{ "aaData":[
[
"1",
"2, 3",
"4",
"5"
] ] }
Now if I want to send some additional information in my json to make some disicisions like to make the contents of second column a hyperlink or nor.How to do that ?

Did you try add your own key into JSON?
{ "aaData":[ [ "1", "2, 3", "4", "5" ] ], "mydata":{"keyN":1, "keyM": [1,2,3,4] } }

Related

Directus Filtering multiple fields

I'm trying to filter Directus CMS data set through URL parameters.
This is a sample data set. I can successfully filter data set by single parameter.
{
"data":[
{
"id": "1",
"status": "published",
"category": "Novel",
"section": "Kids"
},
{
"id": "2",
"status": "published",
"category": "Novel",
"section": "Adults"
}
]
}
/items/books?filter[category][_eq]=Novel
gives me exactly what I expected which is 1 & 2 data records.
But I need to filter both "category" & "section" fields
/items/books?filter[category][_eq]=Novel&filter[section][_eq]=Adults
For above I receive an empty data set.
Why is this getting failed ? Where do I need to fix? Appreciate your support in advance. Thanks!
Try the following query:
/items/books?filter={"_or":[{"category":{"_eq": "Novel"}},{"section":{"_eq":"Adults"}}]}
An expanded version of the filter:
"_or": [
{
"category": {
"_eq": "Novel"
}
},
{
"section": {
"_eq": "Adults"
}
}
]
Visit the official docs to read more about filtering rules and logical operators.

Snaplogic - Expression Language Syntax - unique array value

I am using following EL
jsonPath($, "$array.map({id: value.get('id'), type: value.get('type') })")
which produces the next variable ...
But the key(id) is not kept unique ?!
[{
"id": "1",
"type": "1"
},
{
"id": "1",
"type": "2"
},
{
"id": "2",
"type": "1"
}]
What can i use in snaplogic expression language or a snap to get the following unique key array :
[{
"id": "1",
"types": ["1", "2"],
{
"id": "2",
"type": ["1"]
}]
Any ideas?
Use Group By Fields snap to group based on id and then use a simple mapper to create the desired JSON. Please note that you have to sort the incoming documents by id before doing the group by.
Sample Pipeline
Final Mapper expressions
$groupBy.id mapped to id
jsonPath($, "$groups[*].type") mapped to types
Resulting output

How to convert this complex JSON into spring boot and store in sql server

[
{
"Name": "xyz",
"age": "20",
"socialMedia": [
{
"fb": "aaa"
},
{
"insta": "bbb"
}
],
"languge": "eng",
"country": "USA",
"Experiance": [
{
"developer": {
"companyName": "abcd",
"years": "5"
},
"tester": {
"companyName": "efgh",
"years": "3"
}
}
]
}
]
i am getting this json from front-end and i need to convert this json into spring-boot code and store in H2(in-memory) database......
intentionally i am not sharing my code.....
your answer might help me to enrich my code ...
so, please try to give your best using advanced concepts in spring-boot
Thanks In Advance
Here, you can look about JSON data types: JSON data types
The link includes that how data types present JSON.
Then you can configure object model for JSON data.

Accessing custom attribute array in d3js tree node

I am pretty new to the D3JS library but is it possible to add a custom attribute to the json file for the tree layout to process and retrieve the data while building the tree if the particular attribute is not empty?
For example:
{
"name": "Josphen",
"id": "1",
"children": [
{
"name": "Ronald",
"id": "3"
},
{
"name": "Coxy",
"id": "4",
"spouse": [
{
"name": "baby",
"id": "5"
}
]
}
]
}
Would later allow me to retrieve attribute with id=5 while generating the node of id=4.
Any insight into this is appreciated.

Parse a JSON Object

I have a JSON object like the following:
{
"a" : "test",
"b" : "test",
"c" : [{"d": "test data", "f": ['e','f','g']},
{"f": "test data", "f": ['e','f','g']}
],
"d" : [{"g": "test data", "f": ['e','f','g']},
{"h": "test data", "f": ['e','f','g']}
]
}
I need to parse this and display it in a tree format. Could somebody show some direction please. I am working on ruby.
For a JSON parser, look at JSON.org
Listed there:
json
yajl-ruby
json-stream

Resources