theFlash
Hi guys ,
i need to develop function that generate a n no of jsons.
here iam thinking to pass 2 values for the function.
1) first parameter iam will pass is input.json
input.json
----------
{
"name" : "x" ,
"id" : "x" ,
-------------
-------------
-------------
-------------
"bank" : {
"name" : "x" ,
"id" : "x" ,
------
------
------
------
}
"college" : {
"name" : "x" ,
"id" : "x" ,
-----------
-----------
------------
----------- ,
"dept" : {
"name" : "x" ,
"id" : "x" ,
-----------
-----------
------------
}
}
}
2) i dont know it is the efficient way of giving below input as 2nd parameter , if there is any better way please let me know
in second parameter/input and i need to some how specify the values for name and id keys for the objects of the json above .
eg : i am thinking to give input an HashMap<String , List<String>> like below , size of every list below is same [because i want to generate that many no of jsons ]
{name = ["x","y" ,-------] , id = ["1","2",--------] , bank.name = ["a","b",-------] , bank.id = ["101","102",---------] , college.name = ["a clg","b clg",---] , college.id = ["111","222",---] , college.dept.name = ["cse","ece",-------] , college.dept.id = ["201","202",----------]}
-> as there are n [size of list ] no of indexes for values pair for correspoding key.
using each index value i need to generate one json like wise i need to generate jsons for all indexes
**) if there is any better way of giving input please let me know.
Output
---------
json 1
{
"name" : "x" ,
"id" : "1" ,
-------------
-------------
-------------
-------------
"bank" : {
"name" : "a" ,
"id" : "101" ,
------
------
------
------
}
"college" : {
"name" : "a clg" ,
"id" : "111" ,
-----------
-----------
------------
----------- ,
"dept" : {
"name" : "cse" ,
"id" : "201" ,
-----------
-----------
------------
}
}
}
---------------------------------
json 2
{
"name" : "y" ,
"id" : "2" ,
-------------
-------------
-------------
-------------
"bank" : {
"name" : "b" ,
"id" : "102" ,
------
------
------
------
}
"college" : {
"name" : "b clg" ,
"id" : "222" ,
-----------
-----------
------------
----------- ,
"dept" : {
"name" : "ece" ,
"id" : "202" ,
-----------
-----------
------------
}
}
}
please let me know how should i impliment above problem.
Thank you.
theFlash
Input : you will be given HashMap and 3 String's
1)HashMap :
{name=x, id=x, bank={name=x, id=x}, college={name=x, id=x, dept={name=x, id=x}}}
2)
i : String college.dept.name = "cse"
ii : String college.name = "abc College"
iii : String bank.name = "xyz bank"
Output :
need to generate HashMap below
HashMap :
{name=x, id=x, bank={name=xyz bank, id=x}, college={name=abc college, id=x, dept={name=cse, id=x}}}