Question: I am putting a JSON response into a variable via `requests.json()` like this:

```
response = requests.get(some_url, params=some_params).json()

```

This however converts JSON's original `"` to Python's `'`, `true` to `True`, `null` to `None`.

This poses a problem when trying to save the response as text and the convert it back to JSON - sure, I can use `.replace()` for all conversions mentioned above, but even once I do that, I get other funny json decoder errors.

Is there any way in Python to get JSON response and keep original JavaScript format?

Answer: 
You'll need an Object array instead of a String Array to keep a record of which checkbox was checked:

```
nontrade = [
  { label: 'a', selected: false }, 
  { label: 'b', selected: false }, 
  { label: 'c', selected: false }, 
  { label: 'd', selected: false }
];

trade = [
  { label: 'aa', selected: false }, 
  { label: 'bb', selected: false }, 
  { label: 'cc', selected: false }, 
  { label: 'dd', selected: false }
];

```

Then once either the All Traders or All Non Traders Checkbox is checked, you can make the ammendments to your `allNonTrades` and `allTrades` methods.

```
allNonTrades(event) {
  const checked = event.target.checked;
  this.nontrade.forEach(item => item.selected = checked);
}

allTrades(event) {
  const checked = event.target.checked;
  this.trade.forEach(item => item.selected = checked);
}

```

Finally, you'll have to change the `value` to `checked` for the Attribute Binding in your template:

```
<label class="btn btn-filter">
  <input type="checkbox" name="allNonTrades" [value]="nontrade" (change)="allNonTrades($event)">All NonTrades
</label>&nbsp;
<ng-container *ngFor="let ntrd of nontrade">
  <label class="btn btn-filter">
    <input type="checkbox" name="nontrades" [checked]="ntrd.selected" (change)="changeTradesByCategory($event)">{{ ntrd.label }}
  </label>&nbsp;
</ng-container>

<br>

<label class="btn btn-filter">
  <input type="checkbox" name="allTrades" [value]="trade" (change)="allTrades($event)">All Trades
</label>&nbsp;
<ng-container *ngFor="let trd of trade">
  <label class="btn btn-filter">
    <input type="checkbox" name="trades" [checked]="trd.selected" (change)="changeTradesByCategory($event)">{{ trd.label }}
  </label>&nbsp;
</ng-container>

```

Here's a [**Working StackBlitz**](https://stackblitz.com/edit/angular-check-uncheck-all-checkboxes?file=src/app/app.component.html) for your ref.
In my case, I got the checkbox values from an API and the checkbox to select ALL the other checkboxes were sibling checkboxes.

What happens here is if you check any of the 'ALL' checkboxes all the sibling checkboxes are also checked.

```js
areasAndPermissions = [{
    area: 'all',
    permissions: ['ALL', 'CREATE', 'UPDATE', 'DELETE', 'READ', 'EXPORT'],
  },
  {
    area: 'user',
    permissions: ['ALL', 'CREATE', 'UPDATE', 'DELETE', 'READ', 'EXPORT'],
  },
  {
    area: 'role',
    permissions: ['ALL', 'CREATE', 'UPDATE', 'DELETE', 'READ', 'EXPORT'],
  },
];

onRolesCheckboxChange(areaName, $event) {
  let checkboxValue = $event.target.value;
  // all the sibling checkboxes have the same name
  let checkboxWithSameName = document.querySelectorAll(`[name='${$event.target.name}']`);

  if ($event.target.checked && checkboxValue === 'ALL') {
    checkboxWithSameName.forEach((item) => {
      // Only HTMLInputElement have the checked property so we cast the
      // element so it will transpile
      (item as HTMLInputElement).checked = true;
    });
  }
}
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular/11.0.1/core.umd.js"></script>

<div *ngFor="let roleArea of areasAndPermissions">
  <div>
    <span class="mb-0"> Area: {{ roleArea.area | uppercase }} </span>
  </div>
  <div>
    <div *ngFor="let rolePermission of roleArea.permissions; let i = index">
      <input
        name="{{ roleArea.area }}"
        type="checkbox"
        id="{{ roleArea.area + i }}"
        value="{{ rolePermission }}"
        (change)="onRolesCheckboxChange(roleArea.area, $event)"
      />

      <label for="{{ roleArea.area + i }}">
        {{ rolePermission }}
      </label>
    </div>
  </div>

  <br />
</div>
```

Here is a [working stackblitz](https://stackblitz.com/edit/angular-checkbox-with-same-name?devtoolsheight=33&file=src/app/app.component.ts) of the snippet for your reference