Reported September 2026
Booking.comhash table

Project JSON Fields into a Target Format

Reported by candidates from Booking.com's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Booking.com OA. Under 2s to a working solution.
Founder's read

The Booking.com OA reported in September 2026 looks like a JSON parsing problem, but it isn't. It reduces to a hash map lookup with a default value. You get flattened [path, value] rows and a list of [outputKey, sourcePath] rows, and you return the values in target order. No parsing, no tree building. If you've got an invite for this one, the work is resisting the urge to overthink it. StealthCoder sits invisible on your screen as a safety net if you blank mid-assessment, but this problem is simple enough that you probably won't need it.

The problem

A JSON object has been flattened into sourceFields. Each row is [path, value], where path is a dot-separated object path and value is a valid JSON encoding of the complete value at that path.
The requested target format is given by targetFields. Each row is [outputKey, sourcePath]. Build the target object and return its fields as rows [outputKey, value] in the same order as targetFields.
If sourcePath exists in sourceFields, copy its encoded value unchanged.
If sourcePath is missing, use null, the JSON encoding of a null value.
Paths match exactly and case-sensitively. A dot is part of the path syntax; do not infer parent objects or index arrays.

Function
projectJsonFields(sourceFields: String[][], targetFields: String[][]) → String[][]

Examples
Example 1
sourceFields = [["user.name","\"Ada\""],["user.age","37"],["active","true"]]
targetFields = [["displayName","user.name"],["years","user.age"],["city","user.city"]]
return = [["displayName","\"Ada\""],["years","37"],["city","null"]]
The first two paths exist, so their encoded values are copied. user.city is absent, so the target field receives null.
Example 2
sourceFields = [["order.items","[1,2,3]"],["order.meta","{\"priority\":true}"]]
targetFields = [["items","order.items"],["metadata","order.meta"]]
return = [["items","[1,2,3]"],["metadata","{\"priority\":true}"]]
Arrays and objects remain opaque encoded values. Projection changes field names without parsing or modifying those values.
Example 3
sourceFields = [["Name","\"upper\""],["name","\"lower\""]]
targetFields = [["first","name"],["second","Name"]]
return = [["first","\"lower\""],["second","\"upper\""]]
Path matching is case-sensitive, and output rows preserve the requested order.

Constraints
0 <= sourceFields.length <= 100000.
1 <= targetFields.length <= 100000.
Every row in both arrays contains exactly two strings.
Every source path and output key is non-empty and has length at most 256.
Source paths are unique, and output keys are unique.
Every source value is a valid JSON encoding with length at most 10000.
The total number of characters across both inputs is at most 1000000.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Build a dictionary from sourceFields mapping path to the encoded value string. Then walk targetFields in order. For each [outputKey, sourcePath], look up sourcePath. If it exists, emit [outputKey, value] with the string untouched. If not, emit [outputKey, "null"]. That's O(n + m) time with up to 100000 rows each, so a hash map is the right call and nested loops will time out. The pitfalls are all self-inflicted. Don't parse the JSON values, don't split paths on dots, don't infer parent objects, and don't lowercase anything. Example 3 tests case sensitivity directly. The null fallback is the literal four-character string "null", not a language null. Keep output order identical to targetFields. If you freeze on the OA, StealthCoder can hand you this lookup skeleton in seconds.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Project JSON Fields into a Target Format cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Booking.com's OA.

Booking.com reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Project JSON Fields into a Target Format FAQ

How hard is the Booking.com projectJsonFields problem really?+

Easy. It's a hash map build plus a single pass with a default. The difficulty is in the long statement, not the algorithm. Read the three examples once and you'll see no parsing is needed. Most of the risk is overcomplicating it.

What's the trick to this problem?+

There isn't one beyond treating values as opaque strings. Don't parse JSON, don't split on dots, don't walk nested objects. Store path to value in a map, then look up each target path and fall back to the string "null" when it's missing.

Do I need to parse the JSON values?+

No. Example 2 shows arrays and objects copied unchanged as encoded strings. Parsing risks reformatting whitespace or escaping and breaking exact matches. Copy the string byte for byte and move on.

Which edge cases should I test before submitting?+

Empty sourceFields, since every output becomes "null". Case-differing paths like Name and name. Paths containing dots that shouldn't match a parent. Also confirm output order follows targetFields, not source order, and that large inputs run linear time.

How do I prepare for this in 48 hours?+

Practice hash map build-then-lookup problems until writing them is automatic. Then rehearse reading long statements and extracting the real task. Know your language's map syntax and default-lookup method cold, since that's the entire solution here.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Booking.com.

OA at Booking.com?
Invisible during screen share
Get it