4 kyu
Objectify a URL Query String
2,892 of 2,904OverZealous
Description:
In this kata, we want to convert a URL query string into a nested object. The query string will contain parameters that may or may not have embedded dots ('.'
), and these dots will be used to break up the properties into the nested object.
You will receive a string input that looks something like this:
user.name.firstname=Bob&user.name.lastname=Smith&user.favoritecolor=Light%20Blue
Your method should return an object hash-map that looks like this:
{
'user': {
'name': {
'firstname': 'Bob',
'lastname': 'Smith'
},
'favoritecolor': 'Light Blue'
}
}
- You can expect valid input. You won't see input like:
// This will NOT happen foo=1&foo.bar=2
- All properties and values will be strings — and the values should be left as strings to pass the tests.
- Make sure you decode the URI components correctly
Algorithms
Similar Kata:
Stats:
Created | Nov 16, 2013 |
Published | Nov 16, 2013 |
Warriors Trained | 7951 |
Total Skips | 1822 |
Total Code Submissions | 29682 |
Total Times Completed | 2904 |
JavaScript Completions | 2892 |
Total Stars | 314 |
% of votes with a positive feedback rating | 93% of 368 |
Total "Very Satisfied" Votes | 324 |
Total "Somewhat Satisfied" Votes | 40 |
Total "Not Satisfied" Votes | 4 |