merging 2 json results

totocool

New Member
I have 2 different json resuls parsed with asp extreme plugin; \[code\]{ "checkins": { "data": [ ] } }\[/code\] and \[code\]{ "trips": { "data": [ ] } }\[/code\].But this is causing me lots of troubles. Is there a way to have a just one json file even though I get the data from 2 different databases.So like this; \[code\]{ "checkins": { "data": [ ] }, "trips": { "data": [ ] }\[/code\].\[code\] Case "ViewCheckinsMap"Set Dataset = JSON.parse("{ ""checkins"": { ""data"": [] } }")SQL = "SELECT C.CheckinID, C.MemberID, C.VENUENAME, C.VenueLat, C.VenueLng, C.VENUECREATEDAT, C.CheckInDateEntered"SQL = SQL & " FROM CHECKINS C"SQL = SQL & " WHERE C.CheckinID"SQL = SQL & " IN ( SELECT MAX(CheckinID)"SQL = SQL & " FROM CHECKINS"SQL = SQL & " GROUP BY MemberID"SQL = SQL & " )"SQL = SQL & " ORDER BY VENUECREATEDAT DESC" Set objCheckins = objConn.Execute(SQL)If NOT objCheckins.EOF Then Do While NOT objCheckins.EOF SQL = "SELECT MemberID, FirstName, LastName" SQL = SQL & " FROM MEMBERS" SQL = SQL & " WHERE MemberID = " & objCheckins("MemberID").value Set objMember = objConn.Execute(SQL) Set Record = JSON.parse("{}") Record.set "FirstName", objMember("FirstName").value Record.set "LastName", objMember("LastName").value Record.set "VenueName", objCheckins("VENUENAME").value Record.set "VenueLat", objCheckins("VenueLat").value Record.set "VenueLng", objCheckins("VenueLng").value Record.set "DateEntered", objCheckins("VENUECREATEDAT").value Dataset.checkins.data.push(Record) Set Record = nothing Data = http://stackoverflow.com/questions/15483429/JSON.stringify(Dataset, null, 2) objCheckins.Movenext LoopEnd IfobjCheckins.CloseSet objCheckins = NothingResponse.Write Data Case"ViewTripsMap"Set Dataset = JSON.parse("{ ""trips"": { ""data"": [] } }")SQL = "SELECT T.TripsID, T.MemberID, T.TripFrom, T.TripTo, T.TripDateStarted, T.TripDateEnded"SQL = SQL & " FROM TRIPS T"SQL = SQL & " WHERE T.TripsID"SQL = SQL & " IN ( SELECT MAX(TripsID)"SQL = SQL & " FROM TRIPS"SQL = SQL & " GROUP BY MemberID"SQL = SQL & " )"SQL = SQL & " ORDER BY TripDateEnded DESC"Set objTrips = objConn.Execute(SQL)If NOT objTrips.EOF Then Do While NOT objTrips.EOF SQL = "SELECT MemberID, FirstName, LastName" SQL = SQL & " FROM MEMBERS" SQL = SQL & " WHERE MemberID = " & objTrips("MemberID").value Set objMember = objConn.Execute(SQL) Set Record = JSON.parse("{}") Record.set "FirstName", objMember("FirstName").value Record.set "LastName", objMember("LastName").value Record.set "TripFrom", objTrips("TripFrom").value Record.set "TripFromLat", objTrips("TripFromLat").value Record.set "TripFromLng", objTrips("TripFromLng").value Record.set "TripTo", objTrips("TripTo").value Record.set "TripToLat", objTrips("TripToLat").value Record.set "TripToLng", objTrips("TripToLng").value Record.set "TripDateStarted", objTrips("TripDateStarted").value Record.set "TripDateEnded", objTrips("TripDateEnded").value Dataset.trips.data.push(Record) Set Record = nothing Data = http://stackoverflow.com/questions/15483429/JSON.stringify(Dataset, null, 2) objTrips.Movenext LoopEnd IfobjTrips.CloseSet objTrips = NothingResponse.Write Data\[/code\]
 
Back
Top