Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JSON methods, toJSON#278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
18 commits
Select commitHold shift + click to select a range
08509de
traducción json methods
EzequielCasteJun 22, 2020
67cf345
Update 1-js/05-data-types/12-json/2-serialize-event-circular/task.md
EzequielCasteJul 8, 2020
bef3826
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 8, 2020
77d8205
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 8, 2020
816e630
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 8, 2020
b7f2e14
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 8, 2020
222b916
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 8, 2020
c7e2b99
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 8, 2020
c523264
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 8, 2020
bff4acd
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 8, 2020
eb3c914
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 8, 2020
6c398c1
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 8, 2020
7e2be2b
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 8, 2020
5f21aa8
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 13, 2020
28fb630
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 13, 2020
91ab19c
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 13, 2020
e63a07c
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 13, 2020
3084859
Update 1-js/05-data-types/12-json/article.md
EzequielCasteJul 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions1-js/05-data-types/12-json/1-serialize-object/task.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,9 +2,9 @@ importance: 5

---

#Turn the object into JSONand back
#Convierte el objeto en JSONy de vuelta

Turn the `user`into JSONand then read it back into another variable.
Convierte el `user`a JSONy luego léalo de vuelta en otra variable.

```js
let user = {
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,5 +26,5 @@ alert( JSON.stringify(meetup, function replacer(key, value) {
*/
```

Here we also need to test `key==""`to exclude the first call where it isnormalthat `value` is `meetup`.
Aquí también necesitamos verificar `propiedad==""`para excluir el primer llamado donde esnormalque `valor` sea `meetup`.

View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,13 +2,13 @@ importance: 5

---

#Exclude backreferences
#Excluir referencias circulares

In simple cases of circular references, we can exclude an offending property from serialization by its name.
En casos simples de referencias circulares, podemos excluir una propiedad infractora de la serialización por su nombre.

But sometimes we can't just use the name, as it may be used both in circular references and normal properties. So we can check the property by its value.
Pero a veces no podemos usar el nombre, ya que puede usarse tanto en referencias circulares como en propiedades normales. Entonces podemos verificar la propiedad por su valor.

Write`replacer`function to stringify everything, but remove properties that reference `meetup`:
Escriba la función`replacer`para convertir a string todo, pero elimine las propiedades que hacen referencia a `meetup`:

```js run
let room = {
Expand All@@ -22,16 +22,16 @@ let meetup = {
};

*!*
//circular references
//referencias circulares
room.occupiedBy = meetup;
meetup.self = meetup;
*/!*

alert( JSON.stringify(meetup, function replacer(key, value) {
/*your code */
/*tu código */
}));

/*result should be:
/*el resultado debería ser:
{
"title":"Conference",
"occupiedBy":[{"name":"John"},{"name":"Alice"}],
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp