At first glance, Indonesia appears to be a nation barely concerned with rules.The colour of the traffic lights, for instance, has no connection to what the motorists are actually doing at an intersection.
Lane markings are for decoration only. Adults riding motorcycles wear helmets, but their child passengers never do.
Want to do a nine-point-U-turn across three lanes of traffic? Go for it. No one will even honk at you.
But as I spend more time here, it seems to me that the rules that really matter are the ones that aren't written down.
Be careful where you wear jeansAfter a year in Indonesia it's time to renew my press credentials, which means a trip to the centre of power in Indonesia: the State Palace.
I need to get to the palace's media office but make it as far as the first line of security. A guard holding a sub-machine gun glances at my credentials, and then looks a lot harder at my pants.
He reaches out the hand that's not holding a weapon and pinches a fold of my dark blue trousers.
"Jeans?" he asks.
I'd forgotten perhaps the most rigidly enforced rule in Indonesia: no denim at the State Palace.
No, not jeans! I say, feigning outrage, in my horrible Bahasa Indonesia. "Tidak jeans ... Chinos!"
"Chinos?" he replies.
My colleague Yoto takes over, in Bahasa. "We're just going to get a pass," he says. "We're not visiting the Palace itself. Please can you let my ignorant friend through."
I'm eventually given a day pass, and we proceed.
We walk across the carpark of the palace, into an outer building. Another guard with an automatic weapon, this time with a silencer attached, steps out from behind a desk. He ignores my pass and stares at my pants. He looks shocked.
"Jeans," he says, contemptuously. I'm sure his knuckles whiten around his gun.
The purpose of the silencer becomes clear — quiet executions of inappropriately dressed foreigners.
'Never speak about someone else's religion'Jakarta's Christian governor Ahok is on trial for blasphemy here, not because he incited hatred against Muslims — clearly, he did not.
When he said that Islamic clerics were wrong by stating that Muslims couldn't vote for a Christian, he broke one of Indonesia's key unwritten rule — don't talk about someone else's religion.
At the last big protest against Ahok, I spend hours wandering among the crowd of more than half a million.
Everyone I spoke to was friendly and helpful. They gave me food and drink, took the food wrappers and empty water bottles from me when I'd finished, and shushed each other when I was recording radio news reports.
It all was going fine until I walked away. People started yelling at me, gesturing wildly. I had no idea what the problem was until an English speaker ran up to me, I was walking on the grass of a traffic island.
There are no signs, but everyone in Jakarta knows: keep off the grass.
How a musician ended up in prison for three months
Foreigners sometimes misread Indonesia's unpredictable approach to the rules, just ask those caught in Bali with even the smallest amount of drugs.
Get caught on the beach smoking a joint, and you have an excellent chance of spending at least 12 months in Kerobokan prison.
Every month or two there's another story about a foreigner caught bending the rules on a working visa.
Like US singer Kina Grannis, who came to Jakarta to perform at a single concert, and ended up being detained in Jakarta for three months until her immigration hearing.
She even wrote a song about it.
'The immigration officers swooped'At the ABC we spend months each year in the arduous process of renewing our working visa, called a Kitas. I sometimes wondered why we bother — no-one ever looks at it.
Until earlier this month, when I was in South Jakarta covering the Ahok trial. I was a bit shaken after watching a hardline Islamist mob descend on a man suspected of being a police informer.
They roughed him up for about five minutes until some in the crowd dragged him to the police, who were standing by on the other side of a razor wire barricade, doing nothing.
The plainclothes immigration officers weren't nearly as passive.
As cameraman Phil Hemingway and I walked away they swooped. After 10 minutes of inspecting our documents, they grinned as they let us go, even posing with us for photos.
We'd played by the rules. And neither of us was wearing jeans.
Adam Harvey is the ABC Correspondent based in Jakarta. This article appeared on ABC Online on Saturday 28th January 2017