const object2url = require('./object2url') const testData = { name: "John", age: 13, skills: ['games', 'programming', 'reading', 'singing'], invests: { education: [120.3, 50.5], kids: 70, optical: { north: 20.5, south: 10.70, west: 6, east: [7] }, deeper: { first: { landing: 5, arrayLike: [ { despite: true, superb: 'yes', omg: { kiss: ['la'], maybe: { thiss: { wont: { work: 'false' } } } }, incredible: ['lalolanda', 'raidcall', 'phase', [5], [{waw: '@wesome'}]], } ] } } } }; const encoded = object2url(testData) console.log(encoded) // outputs: name=John&age=13&skills[0]=games&skills[1]=programming&skills[2]=reading&skills[3]=singing&invests[education][0]=120.3&invests[education][1]=50.5&invests[kids]=70&invests[optical][north]=20.5&invests[optical][south]=10.7&invests[optical][west]=6&invests[optical][east][0]=7&invests[deeper][first][landing]=5&invests[deeper][first][arrayLike][0][despite]=true&invests[deeper][first][arrayLike][0][superb]=yes&invests[deeper][first][arrayLike][0][omg][kiss][0]=la&invests[deeper][first][arrayLike][0][omg][maybe][thiss][wont][work]=false&invests[deeper][first][arrayLike][0][incredible][0]=lalolanda&invests[deeper][first][arrayLike][0][incredible][1]=raidcall&invests[deeper][first][arrayLike][0][incredible][2]=phase&invests[deeper][first][arrayLike][0][incredible][3][0]=5&invests[deeper][first][arrayLike][0][incredible][4][0][waw]=%40wesome