title: Big Integer in JSON getting corrupted by Angular but not by CURL?
body: <p>I have created a Django REST API using <a href="http://www.django-rest-framework.org/" rel="nofollow noreferrer">Django Rest Framework</a>.</p>
  
  <p>I use 3 different clients to hit this app:</p>
  
  <ul>
  <li>Curl (for debugging purposes)</li>
  <li>Swagger Interface (for debugging purposes)</li>
  <li>My Angular application</li>
  </ul>
  
  <p>I have a perplexing problem that data returned by the API is being corrupted by Swagger and Angular but not by Curl.</p>
  
  <p>My Django model looks like this:</p>
  
  <pre><code>class MyModel1(CachingMixin, models.Model):
      id = models.BigIntegerField(default=make_id, primary_key=True)
      name = models.CharField(max_length=50, null=False, blank=False,)
  </code></pre>
  
  <p>The <code>make_id()</code> method referenced above is described <a href="https://stackoverflow.com/questions/37558821/how-to-replace-djangos-primary-key-with-a-different-integer-that-is-unique-for">here</a>. I recently implemented this change from the standard Django assigned and auto-incremented primary key. As part of that change, I converted id from an <code>IntegerField</code> to a <code>BigIntegerField</code>.</p>
  
  <p>I have some other Django view code (which I have not shown here) that creates an endpoint called <code>GetMyModel1ByName</code>. That endpoint returns a serialized instance of <code>MyModel1</code>. Here is the curl showing what happens when I hit that endpoint. It works perfectly:</p>
  
  <pre><code>$ curl http://localhost:4212/api/getMyModel1ByName/?name=my-name
  {"id": 10150133855458395, "name": "my-name"}
  </code></pre>
  
  <p>Now here is what happens when I hit the same endpoint from Chrome's Developer console:</p>
  
  <pre><code>&gt; $http = angular.element(document.body).injector().get('$http');
  &gt; $http.get("http://localhost:4212/api/getMyModel1ByName/?name=my-name").then(function(response) { console.log(JSON.stringify(response.data)) }).catch(function (error) { console.log(error.data) });
  {"id":10150133855458396, "name":"my-name"}
  </code></pre>
  
  <p>As you can see curl reports the ID as 10150133855458395. That's correct. That's what is in the Database. However Angular reports it as 1015013385545839<strong>6</strong>. The final digit is wrong. The difference is 1. It's very surprising!</p>
  
  <p>This is a truly perplexing error. My Django code is so simple that I'm very confident that there is no mistake in it. Instead I feel that change the <code>id</code> field from <code>IntegerField</code> to <code>BigIntegerField</code> might have caused this problem. Why is it happening and what is the solution?? It's ruining the functionality of my application. I'm seeing the same corruption when I hit this endpoint through Swagger.</p>
  
  <p><strong><em>EDIT</em></strong>:
  The other questioner is experiencing the same problem I am. It's great to know that I'm not the only one!! However, the answers on that question are not really answers. They don't explain the cause. And they don't tell me how I should solve the issue in my Angular JS code.</p>